Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Calling procedure error - Commands out of sync; you can't run this command now
  • Hi, I posted this question inside another topic which may be a little bit irrelevant, so I thought of posting as a brand new topic. I had a problem with calling procedures in fuelphp using DB class. When I call a procedure after calling another one, I get the following error:
    Fuel\Core\Database_Exception [ 2014 ]: Commands out of sync; you can't run this command now
    Example code:
    $result = \DB::query('CALL get_activities()', \DB::SELECT)
       ->execute();
    
    $result = \DB::query('CALL get_another()', \DB::SELECT)
       ->execute();
    

    I investigated the issue, Mysql reference says that:
    This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without calling mysql_use_result() or mysql_store_result() in between.

    I wonder if this is a bug in fuelphp or is there something I am missing? Thanks and regards
  • I vaguely remember seeing something in the code that the results are only flushed at a particular size of the result set, and not always. This might be the issue here. Please add a ticket to the issue tracker on github, so we can investigate it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion