In my db I have some stored procedures.
I want to call the one of them, and according to the results I get from this procedure, i will determine weather to call the
The currently accepted answer wont work as-is, i think next_result()
should not be called before the first result.
This is an example that does work:
if (!$mysqli->multi_query("CALL p()")) {
echo "CALL failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
do {
if ($res = $mysqli->store_result()) {
printf("---\n");
var_dump($res->fetch_all());
$res->free();
} else {
if ($mysqli->errno) {
echo "Store failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
}
} while ($mysqli->more_results() && $mysqli->next_result());
From the PHP manual http://php.net/manual/en/mysqli.quickstart.stored-procedures.php