从存储过程中获取结果

时间:2012-12-11 13:13:40

标签: php mysql stored-procedures mysqli

如何使用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  */

ui.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 "
  }

0 个答案:

没有答案