bug in mysql.php
| From: | Adam Thomas | Date: | Thu, 27 Sep 2001 03:30:37 +0000 |
| Subject: | bug in mysql.php | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-332@lists.php.net to get a copy of this message | ||
I had some trouble when I tried the following fetchRow call:
$array = $result->fetchRow(DB_FETCHMODE_ASSOC, 0);
It returns null, but row numbers are zero based in mysql results, not sure how they are in other
DBs.
The problem seems to be the following lines of code starting at line 225 of DB/mysql.php
if ($rownum !== null) {
if (($rownum > 0) && ($rownum <= $this->num_rows[$result])) {
@mysql_data_seek($result, $rownum);
} else {
return null;
}
}
The following change seems to fix the problem.
if (($rownum !== null) && ($rownum > 0)) {
if ($rownum <= $this->num_rows[$result]) {
@mysql_data_seek($result, $rownum);
} else {
return null;
}
}
cheers,
-Adam Thomas