$sql1 = "SELECT
indexer,
user_id,
friends_id AS from_id, //Change result name to from_id
'friend' AS type, //For each record found add a result called 'type' containing 'friend'
todays_date
FROM friends
WHERE friends_id = $user_id";
Outputting Results As A Comma Separated List (Or any character separated)
$QueryString = "SELECT CONCAT_WS(',',SomeColumnName0,SomeColumnName1,SomeColumnName2)
FROM MyTable WHERE SomeColumn = 12";
//"CONCAT_WS(','," to cause results to be comma seperated for us
$Query1 = @mysql_query($QueryString);
$ResultsCount = mysql_num_rows($Query1);
while ($result1 = @mysql_fetch_array($Query1))
$ResultString .= $result1[0];
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.