php mysql procedure實現(xiàn)獲取多個結(jié)果集的方法【基于thinkPHP】
本文實例講述了php mysql procedure實現(xiàn)獲取多個結(jié)果集的方法。分享給大家供大家參考,具體如下:
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相關內(nèi)容感興趣的讀者可查看本站專題:《php+mysqli數(shù)據(jù)庫程序設計技巧總結(jié)》、《php面向?qū)ο蟪绦蛟O計入門教程》、《PHP數(shù)組(Array)操作技巧大全》、《PHP基本語法入門教程》、《PHP運算與運算符用法總結(jié)》、《PHP網(wǎng)絡編程技巧總結(jié)》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家PHP程序設計有所幫助。
相關文章
php封裝pdo實例以及pdo長連接的優(yōu)缺點總結(jié)
在本篇文章里小編給大家整理的是一篇關于php封裝pdo實例以及pdo長連接的優(yōu)缺點總結(jié)內(nèi)容,對此有興趣的朋友們可以跟著學習下。2021-12-12php array_map array_multisort 高效處理多維數(shù)組排序
用array_map和array_multisort高效處理多維數(shù)組排序的實現(xiàn)代碼。2009-06-06