简体   繁体   English

没有调用多个存储过程?

[英]Multiple stored procedure are not getting called?

Below image contain my code. 下图包含我的代码。

在此处输入图片说明

here, only one procedure is invoked at a time.Both procedure are not working . 在这里,一次只调用一个过程。两个过程都不​​起作用。 here if state procedure is commented then city procedure called. 如果状态程序被注释,则调用城市程序。 and if city in commented then State procedure is working. 如果评论中的城市,则说明州程序正在运行。

for example , you can call multiple stored procedure like this below code 例如,您可以像下面的代码那样调用多个存储过程

$db = mysqli_connect([...]);  


$r = mysqli_query($db, " CALL getSomething(2); ");  
while($row = mysqli_fetch_assoc($r)) {  
      print_r($row);  
}  

mysqli_free_result($r);  
mysqli_next_result($db);  

$r = mysqli_query($db, " CALL getSomethingElse(); ");  
while($row = mysqli_fetch_assoc($r)) {  
      print_r($row);  
}  

mysqli_free_result($r);
mysqli_next_result($db);  
mysqli_close($db);

it is important to use the functions mysqli_free_result() and mysqli_next_result() after the MySQL stored procedure is called, otherwise, the code will not work and you may see an error like "Commands out of sync; you can't run this command now". 在调用MySQL存储过程之后,请务必使用mysqli_free_result()和mysqli_next_result()函数,否则,该代码将无法正常工作,并且您可能会看到类似“命令不同步;您现在无法运行此命令”的错误信息”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM