trouble with mysql_fetch_array in a function
Posted: Sun Jan 24, 2010 7:09 pm
Hello all,
I am having a bit of a struggle with a function that uses mysql_fetch_array().
This results in
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in functions.php on line 5
I am having a bit of a struggle with a function that uses mysql_fetch_array().
Code: Select all
function sql_query($query)
{
$result = mysql_query($query) or die('SQL query error '.$query.' '.mysql_error());
$data = mysql_fetch_array($result);
mysql_close();
return array($result, $data);
}
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in functions.php on line 5