开发者

Getting error "Commands out of sync, you can't run the command now" while executing a stored procedure in mysql/PHP

I have written a stored procedure for a table, and after that i am executing queries for same table in php function, But i am get开发者_开发百科ting error :

Error in db : Commands out of sync, you can't run the command now..

I tried mysqli: multi_query also instead of mysqli:query, but i got null output. Can anyone please help me to sort out this problem.

P.S : stored proceure is working as expected and query are also correct.. but together it returns the error.


You have to consume all selects, and navigate to next result

$sql="";
if (mysqli_multi_query($link, $sql)) {
    do {
        if ($result = mysqli_store_result($link)) {
            while ($row = mysqli_fetch_array($result)) {
                array_push($arrows,$row);
            }
            mysqli_free_result($result);
        }
    } while (mysqli_next_result($link));
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜