MySQL Error - Commands out of sync; you can't run this command now

前端 未结 4 1051
一生所求
一生所求 2021-01-06 11:38

I am using MySQL with PHP, Codeigniter. I had a question which was answered by bluefeet in the post here

I created a stored procedure for the second solution by blue

4条回答
  •  礼貌的吻别
    2021-01-06 12:13

    Try:

    more_results() && $dbms->next_result())
        {
            $result = $dbms->store_result();
    
            if(is_object($result)){ $result->free(); }
    
            unset($result);
        }
    ?>
    

    After procedure call. MySQLi can't call another procedure, while has previous results. You should use free() for each of them before any further procedure call or query execution.

    Source: http://php.net/manual/en/mysqli.query.php

提交回复
热议问题