<?php
require_once ('connect.php');
$sql="select * from table1;";
$sql.="select id,username,age from user;";
$mysqli->multi_query($sql);
if($mysqli->multi_query($sql)){
do{
if($res=$mysqli->store_result()){ //use_result()或store_result()得到查询的结果集
$rows[]=$res->fetch_all(MYSQLI_ASSOC);
// mysql_free_result($res);
$res->free_result();
}
}while($mysqli->more_results()&&$mysqli->next_result());//more_result()检测是否有更多的结果集,next_result()将结果集指针向下移动一位
}else{
echo $mysqli->error;
}
print_r($rows);
$mysqli->close();
?>
结果显示:
Commands out of sync; you can't run this command now
浮沉随浪
南大亚多