note 101405 added to mysqli-result.free
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 15 Dec 2010 06:48:46 +0000 |
| Subject: | note 101405 added to mysqli-result.free | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174933@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.
$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);
}
}
}
----
Server IP: 192.41.42.26
Probable Submitter: 99.8.80.44
----
Manual Page -- http://www.php.net/manual/en/mysqli-result.free.php
Edit -- https://master.php.net/note/edit/101405
Del: integrated -- https://master.php.net/note/delete/101405/integrated
Del: useless -- https://master.php.net/note/delete/101405/useless
Del: bad code -- https://master.php.net/note/delete/101405/bad+code
Del: spam -- https://master.php.net/note/delete/101405/spam
Del: non-english -- https://master.php.net/note/delete/101405/non-english
Del: in docs -- https://master.php.net/note/delete/101405/in+docs
Del: other reasons-- https://master.php.net/note/delete/101405
Reject -- https://master.php.net/note/reject/101405
Search -- https://master.php.net/manage/user-notes.php