php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4507 Object fetch outputs error when index is greater than # of records
Submitted: 2000-05-18 14:14 UTC Modified: 2000-07-14 23:57 UTC
From: dchapman at houabg dot com Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 4.0.0 OS: FreeBSD 4.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
8 + 13 = ?
Subscribe to this entry?

 
 [2000-05-18 14:14 UTC] dchapman at houabg dot com
This code in the manual outputs warning/notification errors when $row is greater than the # of records.  Would a for loop be a better choice?  I've had to turn off warning in the php.ini to get let pages work correctly.

while ($data = pg_fetch_object ($qu, $row)):
 14     echo $data->autor." (";
 15     echo $data->jahr ."): ";
 16     echo $data->titel."<BR>";
 17     $row++;
 18 endwhile; ?>
 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-14 23:57 UTC] jah at cvs dot php dot net
Either put @ before pg_fetch_object() to suppress the warning, or use
pg_numrows() first to get the number of rows in the result set. Whether you use
a for or while loop is a personal preference, I doubt there's not much difference
in performance.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 17:01:29 2024 UTC