命令不同步;当我在循环中运行时,您现在无法运行此命令 [英] Commands out of sync; you can't run this command now when i run in loop

查看:29
本文介绍了命令不同步;当我在循环中运行时,您现在无法运行此命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 stoe 过程放入 for 循环时,我收到了上述错误.

When i put stoe procedure inside for loop i am getting error as above.

我正在使用 phpmyadmin

i am using phpmyadmin

谁能帮帮我

$sum=0;

for($i=0;$i<10;$i++){
    $overall_sat=mysql_query("call daily_sales('HO Bangalore','2013-07-01','2013-07-06')");

    while($row=mysql_fetch_row($overall_sat)){?>
        <td><?php echo $row['sat'];
        $sum=$sum+$row['sat'];?></td>
    <?}
 }
 if(!$overall_sat){
    echo mysql_error();
 }
 ?>

推荐答案

我的猜测是您的存储过程返回多个结果集.只有在获取了所有 挂起的结果后,才能在连接上发出新查询.要处理过程调用结果,您需要使用mysqli_next_result()/mysqli_more_results().请参阅示例.

My guess is that your stored procedure returns multiple result sets. A new query can only be issued on a connection after all pending results have been fetched. To process procedure call results you need to use mysqli_next_result() / mysqli_more_results(). See example.

停止使用mysql,它已经过时了.

Stop using mysql, it's outdated.

这篇关于命令不同步;当我在循环中运行时,您现在无法运行此命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆