Commands out of sync; you can't run this comma

2019-08-01 04:01发布

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

i am using phpmyadmin

Can anyone plz help me

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

1条回答
相关推荐>>
2楼-- · 2019-08-01 04:16

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.

Stop using mysql, it's outdated.

查看更多
登录 后发表回答