I posted before, but have now narrowed my problem down to this method.
At the start of the method, I test to make sure that I have a
resource, a pointer to data returned from a database. This test is
coming back true, so the next line runs, which attempts to get the
next row from the dataset. This brings back nothing. On the queries
I'm running right now, the first row will be fetched, but then no
further rows. If I expect 20 rows back, I get one, then 19 errors. I
use phpMyAdmin to run the query in another environment, to be sure of
what I should be expecting.
Any ideas why the resource pointer might still test valid, yet return
nothing?
/**
* 11-04-03 - it is important that the resource which points to the
returned dataset gets passed into this method
* by reference, not by copy, or else, in the outside code that is
calling this method, the pointer in that resource
* will never advance to the next resource row.
*/
function dsRowIntoArrayW ithStringIndex( &$dsResult) {
// 11-04-03 - this first lines test to see if anything came back
from the datastore
if (is_resource($d sResult)) {
$row = mysql_fetch_arr ay($dsResult, MYSQL_ASSOC);
$row = $this->stripslashesFr omEntryWithKeyI ndex($row);
return $row;
} else {
$this->resultsObjec t->addToErrorResu lts("In
dsRowIntoArrayW ithStringIndex( ), in the class McFormatResults MySql, we
expected the method to be handed a pointer to a database return
resource, but we were not.");
}
}
At the start of the method, I test to make sure that I have a
resource, a pointer to data returned from a database. This test is
coming back true, so the next line runs, which attempts to get the
next row from the dataset. This brings back nothing. On the queries
I'm running right now, the first row will be fetched, but then no
further rows. If I expect 20 rows back, I get one, then 19 errors. I
use phpMyAdmin to run the query in another environment, to be sure of
what I should be expecting.
Any ideas why the resource pointer might still test valid, yet return
nothing?
/**
* 11-04-03 - it is important that the resource which points to the
returned dataset gets passed into this method
* by reference, not by copy, or else, in the outside code that is
calling this method, the pointer in that resource
* will never advance to the next resource row.
*/
function dsRowIntoArrayW ithStringIndex( &$dsResult) {
// 11-04-03 - this first lines test to see if anything came back
from the datastore
if (is_resource($d sResult)) {
$row = mysql_fetch_arr ay($dsResult, MYSQL_ASSOC);
$row = $this->stripslashesFr omEntryWithKeyI ndex($row);
return $row;
} else {
$this->resultsObjec t->addToErrorResu lts("In
dsRowIntoArrayW ithStringIndex( ), in the class McFormatResults MySql, we
expected the method to be handed a pointer to a database return
resource, but we were not.");
}
}
Comment