I having an interesting issue. I can't get PHP to execute two stored procedures from MySQL in a row. Here is a sample procedure (we simplified it a bit for this example)
DELIMITER $$
DROP PROCEDURE IF EXISTS `test_proc`$$
CREATE PROCEDURE `test_proc`(i int(3))
BEGIN
select 1+i;
END $$
DELIMITER ;
Works from inside of MySQL all day.
Now, I tried everything Pear DB, Pear MDB2 mysql, pear Mdb2 mysqli and have been unable to get it to run twice in a row. I am using pear Mdb2 mysqli
$res3 = $mdb2->executeStoredProc("test_proc",array('3'));
if (PEAR::isError($res3)) {
print_r($res3->getMessage());
which works and returns - 4 ... however if the page has
$res2 = $mdb2->query("select count(*) from test"); //this works
if (PEAR::isError($res2)) {
print_r($res2->getMessage());
$res3 = $mdb2->executeStoredProc("test_proc",array('3')); //this works
if (PEAR::isError($res3)) {
print_r($res3->getMessage());
} print_r($res3->fetchRow());
$res4 = $mdb2->executeStoredProc("test_proc",array('3')); //this doesn't
if (PEAR::isError($res4)) {
print_r($res4->getMessage());
the second procedure fails SOMETIMES, I tried changing the second call object to be other names, no luck ... Basically my issue is
It work the first time, but not the second time or if you reload the page quickly which makes it fail too.
Error:
Array ( [0] => 931302 ) Array ( [0] => 4 ) MDB2 Error: Array
Fatal error: Call to undefined method MDB2_Error::fetchRow() in C:\xampp\xampp\htdocs\dev\test.php on line 34 <-- which is the line of the 2nd proc call .. but it works the first time so its defined...
How can we call multiple stored procedures in a row from PHP?
Thank you for any help!