I'm trying to access a MYSQL procedure from PHP with mysql_query and mysql_fetch_array but then after the procedure returns valid i receive the following errors on other queries.
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
My code:
function sql_fetch($sql){
global $lang;
$query = mysql_query($sql);
if($query === FALSE) {
die(mysql_error()); // TODO: better error handling
}
while($row = mysql_fetch_array($query))
$a[] = $row;
return $a;
}
$menus = sql_fetch("call GetTop4Products();"); // here returns all right
$news = sql_fetch("select * from news order by date_created desc limit 0,3"); // here returns error.
if instead of calling procedure i put the procedure sql code, everything runs smooth.
and the error i receive:
Commands out of sync; you can't run this command now