note 101405 modified in mysqli-result.free by danbrown

From: Date: Wed, 15 Dec 2010 17:34:11 +0000
Subject: note 101405 modified in mysqli-result.free by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174960@lists.php.net to get a copy of this message
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); } } } ?> --was-- 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. $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); } } } http://php.net/manual/en/mysqli-result.free.php

« previous php.notes (#174960) next »