php教程

超轻量级php框架startmvc

php mysql procedure实现获取多个结果集的方法【基于thinkPHP】

更新时间:2020-03-14 21:04:44 作者:startmvc
本文实例讲述了phpmysqlprocedure实现获取多个结果集的方法。分享给大家供大家参考,具体如

本文实例讲述了php mysql procedure实现获取多个结果集的方法。分享给大家供大家参考,具体如下:


protected function getRs($id) {
 $db = new mysqli(C("DB_HOST"), C("DB_USER"), C("DB_PWD"), C("DB_NAME"), C("DB_PORT"));
 if (mysqli_connect_errno())
 throw_exception(mysqli_connect_error());
 $sql = "call `room_match`.`wsKocMatchLoadResultHeader`($id);";
 $results = array();
 if ($db->multi_query($sql)) {
 do {
 $records = array();
 if ($result = $db->use_result()) {
 while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
 $records[] = $row;
 }
 $result->close();
 }
 $results[] = $records;
 } while ($db->next_result());
 }
 $db->close();
 $this->assign("list1", $results[1]);
 $this->assign("list2", $results[2]);
 $this->assign("list3", $results[3]);
}

php mysql procedure 获取 结果集