Getting "Error: Commands out of sync; you can't run this command now" after running a multi-query? Make sure you've cleared out the queue of results.
Here's what I've used to discard all subsequent results from a multi-query:
<?php
while($dbLink->more_results() && $dbLink->next_result()) {
$extraResult = $dbLink->use_result();
if($extraResult instanceof mysqli_result){
$extraResult->free();
}
}
?>