如何使用 mysqli 和存储过程获得 2 个结果?
db_class.php
/* some class code */
function GetList1()
{
return $this->dbconn->query("CALL list1()");
}
function GetList2()
{
return $this->dbconn->query("CALL list2()");
}
/* some class code */
用户界面.php
$res1 = $db->GetList1();
while ($row = $res1->fetch_array(3))
{
echo $row[0]; // already working
}
// $res1->free_result(); -- not helped
$res2 = $db->GetList2();
while ($row = $res2->fetch_array(3))
{
echo $row[0]; // getting error " Fatal error: Call to a member function fetch_array() on a non-object in "
}