How to run two customised queries in succession
Hello,
I have what appears to be a strange issue in PHPMaker 10.
I am have two stored procedures in MySQL, each of which return a specific set of records, each accepting one integer parameters. Both stored procedures work fine when I run them in a MySQL client outside of PHPMaker. Let's call them storedproc1 and storedproc2. Each stored proc runs a different SELECT statement which uses the corresponding parameter.
Now, in PHPMaker, I have a PHP function defined in the global code server events that needs to get the results of both of these stored procs. I call them up in succession in the following manner:
$rs = ew_Execute("CALL storedproc1 (" . $param . ")");
$rs->MoveFirst();
while (!$rs->EOF) {
//put data into first array structure
}
$rs->Close();
$rs = ew_Execute("CALL storedproc2 (" . $param . ")");
$rs->MoveFirst();
while (!$rs->EOF) {
//put data into second array structure
}
$rs->Close();
The issue is this: the first query runs well and I get data populated into the first array. The second one does not execute and the result set variable $rs gets a boolean value of FALSE, so a fatal error occurs when it tries to execute the MoveFirst() function. Now, when I comment out the call to the first stored procedure, storedproc1, in the PHP function, the call to the second stored procedure then works fine and returning data. Is there something else I need to do between query executions to get this to work? I tried using Conn()->Execute instead of ew_Execute, but the same result occurs. I also tried using both mysqli extension and not, and, again, the same result.
Any help would be appreciated.
Thank you in advance.
Robert Perez