NYCPHP Meetup

NYPHP.org

[nycphp-talk] Problem with exeuting query while using PHP5 - Commands out of sync; you can't run this command now

Mark Armendariz lists at enobrev.com
Fri Jun 13 16:02:28 EDT 2008


shaiju davis wrote:
> Hi All,
>
>    When I try to call the second Stored procedure from PHP , I get 
> this following error
>                             "Commands out of sync; you can't run this 
> command now".
>   When I search I get the result as, it is because of the buffering 
> problem with the opened connection. Anyone know how to fix it?
>  
>    

I had that problem while using mysqli_multi_query on a fairly large 
dataset (imdb database) not too long ago.  I don't remember the exact 
reason that was explained (mostly because there wasn't a very good one 
given), but in the end, I found that running store_result on the result 
set took care of the problem.  Considering the solution, I think it's 
related to buffering, as you mentioned.
                   
        $oDb->multi_query($sUpdate);
       
        // clears the buffer
        while($oDb->next_result()) {
            $oDb->store_result();
        }

Mark



More information about the talk mailing list