<?php
//turn the exception more off
mysqli_report(MYSQLI_REPORT_ALL ^ MYSQLI_REPORT_STRICT);
$query = "SELECT 'ok 1';
SELECT 'ok 2';
SElllllECT 'failed'; # error in the 3rd query
SELECT 'ok 3'";
if ($mysqli->multi_query($query)) {
do {
/* store first result set */
if ($result = $mysqli->store_result()) {
while ($row = $result->fetch_row()) {
printf("%s\n", $row[0]);
}
$result->free();
}
/* print divider */
if ($mysqli->more_results()) {
printf("-----------------\n");
}
} while ($mysqli->next_result());
}
if ($error = $mysqli->error) {
// HERE YOU GO: there was an error!
throw new ErrorException($error);
}