MySQL Forums
Forum List  »  PHP

Re: Commands out of sync; you can't run this command now
Posted by: Kris Oye
Date: October 23, 2007 04:02AM

I had this problem, too. It was usually caused by a stored procedure that returned more than one dataset (ala Martijn). I added a quick little function to clear out results to prepare a connection for re-use.

function mysqli_clean_connection($dbc)
{
while(mysqli_more_results($dbc))
{
if(mysqli_next_result($dbc))
{
$result = mysqli_use_result($dbc);
mysql_free_result($result);
}
}
}

After adding it, though, I didn't see that message again... from this particular problem, anyway.

Options: ReplyQuote


Subject
Written By
Posted
Re: Commands out of sync; you can't run this command now
October 23, 2007 04:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.