I have a stored procedure in my db that returns all the records in a table:
CREATE PROCEDURE showAll()
BEGIN
SELECT * FROM myTable;
END
SP works as expected. But if I call it in a php script and then try to query the database again, it always fails:
if (!$t = $mysqli->query("call showAll()"))
die('Error in the 1st query');
while ($r = $t->fetch_row()) {
echo $r[0] . "<br>";
}
$t->free();
if (!$t = $mysqli->query("SELECT * from myTable"))
die('Error in the 2nd query');
while ($r = $t->fetch_row()) {
echo $r[0] . "<br>";
}
Itβs great if I change two requests (i.e. I will call the stored procedure at the end), it works without any errors. Closing () the result before the second query does not help. Some clues?
EDIT: mysqli :: error (): "Commands are not synchronized; you cannot run this command now."
source
share