<?php
$mysqli = new mysqli("localhost", "username", "password","mydatabase", 3306);
$queries = "SELECT * FROM mytable; SELECT * FROM anothertable";
if(mysqli_multi_query($mysqli, $queries)) {
do {
if($result = mysqli_store_result($mysqli)) {
while($row = mysqli_fetch_row($result)) {
foreach($row as $key => $value) {
echo "$key => $value<BR/>\n";
}
}
mysqli_free_result($result);
}
if(mysqli_more_results($mysqli)) {
echo "<BR/>\nNext result set<BR/>\n";
}
} while(mysqli_next_result($mysqli));
}
mysqli_close($mysqli);
?>
|