【问题标题】:Getting error "Commands out of sync, you can't run the command now" while executing a stored procedure in mysql/PHP在 mysql/PHP 中执行存储过程时出现错误“命令不同步,您现在无法运行命令”
【发布时间】:2011-10-07 17:55:03
【问题描述】:

我已经为一个表编写了一个存储过程,之后我在 php 函数中对同一个表执行查询,但是我得到了错误:

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

我也尝试了 mysqli:multi_query 而不是 mysqli:query,但我得到了空输出。 谁能帮我解决这个问题。

P.S:存储过程按预期工作,查询也正确..但它一起返回错误。

【问题讨论】:

    标签: php mysql stored-procedures


    【解决方案1】:

    您必须使用所有选择,然后导航到下一个结果

    $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));
    }
    

    【讨论】:

      猜你喜欢
      • 2019-04-25
      • 2012-03-27
      • 2013-08-29
      • 2012-09-26
      • 2019-03-05
      • 2012-07-19
      • 2012-12-01
      • 2018-05-11
      • 1970-01-01
      相关资源
      最近更新 更多