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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dchapman at houabg dot com
New email:
PHP Version: OS:

 

 [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: Tue Apr 16 17:01:30 2024 UTC