Below is the code that i am having trouble with:
$stmt->store_result();
if($stmt->num_rows<1) return false;
$res2=$stmt->get_result();
if($GLOBAL_DB->error) die($GLOBAL_DB->error);
while($res=$res2->fetch_array(MYSQLI_ASSOC)) $result[]=$res['Field'];
I get the following error when i run the code: Commands out of sync; you can't run this command now
. Everything before this code works 100% because it has been tested. The thing is, this code worked before, but then i wanted to check on the num_rows
as well as fetching.
The following code works fine:
$res2=$stmt->get_result();
if($GLOBAL_DB->error) die($GLOBAL_DB->error);
while($res=$res2->fetch_array(MYSQLI_ASSOC)) $result[]=$res['Field'];
This is the error i'm getting
Commands out of sync; you can't run this command now