multi query - "Commands out of sync; you can't run this command now" - Caused by mysqli::multi_query -
i running multiple deletes through mysqli::multi_query , messing next query in line.the following error being thrown.
error - sqlstate hy000. sql error: commands out of sync; can't run command
do need somehow clear multiquery doesn't mess next query? cause of error?
and how running multiquery
function deletesometables($args){ $sql = 'delete 1;delete another;'; if($database->multi_query($sql)){ return true; }else{ return false; } }
i using recent version of xampp on windows 7
by using mysqli::multi_query firing off queries, need handle results of queries before move on. documentation page describes various ways of handling results. once handled, able perform other queries fine.
the error message encountering explained little better on page mysqli::query (although bear in mind mysqli::query not return result object in instance, doing delete).
you of course change multi_query multiple single queries, don't know pros/cons of each approach are.
Comments
Post a Comment