這個總是報:Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in E:\phpStudy\WWW\ceshi\mysqli.php on line 113
public function fetch_more_sql($table1, $table2)
{
$sql ?= "SELECT * FROM ".$table1." LIMIT 1; SELECT * FROM ".$table2." LIMIT 1";
if(mysqli_multi_query($this ->db_connect(), $sql))
{
do{
//存儲第一個結(jié)果集
if($result = mysqli_store_result($this ->db_connect() ))
{
while($row = mysqli_fetch_row($result)){
foreach ($row as $key => $value) {
echo $key;
}
}
mysqli_free_result($result);
}
} while( mysqli_next_result( $this ->db_connect()) && mysqli_more_results($this ->db_connect()) );
}
// print_r($rows);
}
2016-09-10
入過我沒看過的話,你用的一次只能執(zhí)行一次SQL語句但是你執(zhí)行了2條。$sql ?= "SELECT * FROM ".$table1." LIMIT 1; SELECT * FROM ".$table2." LIMIT 1";
,第二不要動態(tài)拼裝SQL語句,慎防SQL注入,和自己拼寫錯誤,應(yīng)該用預(yù)處理語句,然后綁定參數(shù)試試