A little editing is in order.
function db_result_to_array($result)
{
$res_array = array();
for ($count=0; $row = @mysql_fetch_array($result); $count++)
{$res_array[$count] = $row;} //added braces here
return $res_array;
}
Now the function makes sense.
You could simplify and just create $res_array on the fly, this way.
function db_result_to_array($result)
{ for ($count=0;$res_array[]= @mysql_fetch_array($result); $count++)
return $res_array;
}
I've got a function sort of like this in most of my code; others probably have a similar one. You'd use it like this:
$result=mysql_query('SELECT * FROM table');
$resultarray=db_result_to_array($result) ;
then manage the $resultarray however you please.
Or even:
$resultarray=db_result_to_array(mysql_query('SELECT * FROM table')) ;