$sql1 = "SELECT
    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'
  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];


We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.