如何在一个php页面中调用多个sql存储过程



我正在尝试调用同一页面中的两个sql存储过程我试过的是

mysqli_query($con,"DROP PROCEDURE IF EXISTS count_nodes_all_1 "); 
mysqli_query($con,"CREATE PROCEDURE count_nodes_all_1()
BEGIN
CALL count_nodes_left_1('id-1',750);
CALL count_nodes_right_1('id-2',750);
END"); 
$qry = "CALL count_nodes_all_1";                     
if ($result = mysqli_query($con, $qry)) 
{
while ($row = mysqli_fetch_array($result)) 
{



$total_left_1 = $row['total_left_1'];
$total_right_1 = $row['total_right_1'];

?>
<th scope="row"><?php echo number_format($total_left_1); ?></th>
<th scope="row"><?php echo number_format($total_right_1); ?></th>

这里$total_left_1 = $row['total_left_1'];是第一过程的输出,$total_right_1 = $row['total_right_1'];是第二过程的输出现在,问题是我正在获取<?php echo number_format($total_left_1); ?>的输出,而无法获取<?php echo number_format($total_right_1); ?>的输出。它只是显示Notice: Undefined index: total_right_1 in G:XampNewhtdocs请帮我做这个

您需要使用mysqli_fetch_array两次

最新更新