note 101405 deleted from mysqli-result.free by danbrown

From: Date: Mon, 27 Dec 2010 17:28:47 +0000
Subject: note 101405 deleted from mysqli-result.free by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175246@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- Using $mysqli->free(); hasn't always worked for me. I would still get ‘Commands out of sync; you can’t run this command now’ whenever I tried to call a procedure a second time. This is a hacky work around but it has worked for me. <?php $mysqli = new mysqli($creds[0], $creds[1], $creds[2], $creds[3]); $result = $mysqli->query($sql); $assocAry = $result->fetch_assoc(); //$mysqli->free(); //---Didn't work clean_mysqli_connection($mysqli); //---Did work function clean_mysqli_connection( $mysqli ) { while( mysqli_more_results($mysqli) ) { if(mysqli_next_result($mysqli)) { $result = mysqli_use_result($mysqli); unset($result); } } } ?>

« previous php.notes (#175246) next »