Developer's Closet A place where I can put my PHP, SQL, Perl, JavaScript, and VBScript code.

Function to Create an Array from Database Results in PHP

This simple function will create an array out of the multi-dimensional rows returned from a database query.

function mysql_fetch_array_r($result,$result_type=MYSQL_NUM) {
	$arr = array();
	for($i=0;$i<@mysql_num_rows($result);$i++)  {
	return $arr[0]; // on error, $arr is empty
Tagged as: , No Comments