php - 在 mysql/PHP 中执行存储过程时出现错误 "Commands out of sync, you can' t 立即运行命令

标签 php mysql stored-procedures

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

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

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

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

最佳答案

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

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

关于php - 在 mysql/PHP 中执行存储过程时出现错误 "Commands out of sync, you can' t 立即运行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7691010/

相关文章:

php - 使用 POST android 发送 php 数组

php - 我怎样才能只显示小时和分钟?

mysql - dbListTable 函数错误

mysql - 需要递归逻辑的 SQL 查询

mysql - 如何在 perl dbi 中为 mysql 连接设置 CLIENT_MULTI_RESULTS 标志

php - 寻找用于交互式网络对象演示的 PHP/Flash 图形库

PHP:MY​​SQL 数组到 JSON 停止重复?

mysql order by 不包括0

sql - 如何将输入参数传递给sp_executesql?

sql-server - sp_helptext 中过程的旧名称