I broke this question in essence, but I still have problems.
When I try to use fetch_all to get the results of the stored procedure, I get the results returned to the array as expected, but subsequent mysqli calls cause "command out of sync" errors.
I even tried to simplify my stored procedure to ...
CREATE PROCEDURE testp()
BEGIN
SELECT * FROM tbl
END
I made the table small, 10 rows 3 cols.
I am using the following php
$query = "CALL testp()";
$result = $db->query($query);
$rows = $result->fetch_all(MYSQL_ASSOC);
$result->free();
print_r($rows);
$query = "SELECT * FROM tbl WHERE id = ?";
$stmt = $this->db->prepare($query);
echo $this->db->error;
$stmt->close();
Echo "Commands are not synchronized, you cannot run this command now" and throws a fatal error: call of the member function close () on a non-object
$ prints strings as expected
Any ideas?
source
share