Voting

: one plus five?
(Example: nine)

The Note You're Voting On

matthewv at ca dot ibm dot com
16 years ago
Some not so obvious but imported notes:

1) You must always use the original statement return when fetching the next result set.
2) You can not remove a reference to a previous result set if you wish to access another result set.

----------------WILL NOT WORK-------------------------
<?php
$originalStatementReturn
= db2_exec($conn, 'CALL multiResults()');

$firstResultHolder = db2_next_result($originalStatementReturn);

$secondResultHolder = db2_next_result($firstResultHolder);

if (
$secondResultHolder) {
while (
$row = db2_fetch_array($secondResultHolder)) {
print_r($row);
}
}
?>
-----------------------------------------------------------------

----------------WILL NOT WORK-------------------------
<?php
$originalStatementReturn
= db2_exec($conn, 'CALL multiResults()');

$resultHolder = db2_next_result($originalStatementReturn);

$resultHolder = db2_next_result($originalStatementReturn);

if (
$resultHolder) {
while (
$row = db2_fetch_array($resultHolder)) {
print_r($row);
}
}
?>
-----------------------------------------------------------------

----------------WILL WORK--------------------------------
<?php
$originalStatementReturn
= db2_exec($conn, 'CALL multiResults()');

$firstResultHolder = db2_next_result($originalStatementReturn);

$secondResultHolder = db2_next_result($originalStatementReturn);

if (
$secondResultHolder) {
while (
$row = db2_fetch_array($secondResultHolder)) {
print_r($row);
}
}
?>
-----------------------------------------------------------------

<< Back to user notes page

To Top