问题描述
我正在尝试在同一页面中调用两个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:\XampNew\htdocs
请帮助我
解决方法
您需要两次使用mysqli_fetch_array