<?php
$mysqli = new mysqli("localhost","root","","new");
$mysqli->query("set names 'utf8");
//多条
sql语句
$sql = "select id,name from `user`;";
$sql .= "select id,mail from `user`";
echo $sql;
if ($mysqli->multi_query($sql)){//multi_query()执行一条或多条sql语句
do{
if ($rs = $mysqli->store_result()){//store_result()方法获取第一条sql语句查询结果
while ($row=$rs->fetch_row()){
var_dump($row);
echo "<br>";
}
$rs->Close(); //关闭结果集
if ($mysqli->more_results()){ //判断是否还有更多结果集
echo "<hr>";
}
}
}while($mysqli->next_result());//next_result()方法获取下一结果集,返回bool值
}
$mysqli->close(); //关闭数据库连接
?>