|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7688 loop with in pg_fetch_object
Submitted: 2000-11-08 00:22 UTC Modified: 2000-11-08 15:49 UTC
From: chris dot millsaps at wcom dot com Assigned:
Status: Closed Package: *Function Specific
PHP Version: 4.0.3pl1 OS: Rehat 7.0
Private report: No CVE-ID: None
 [2000-11-08 00:22 UTC] chris dot millsaps at wcom dot com
cannot break out of a while loop using pg_fetch_object. code is as follows: It produces the same row over and over.

function showmessages($parentid)
{ global $dblink;
$Query= "Select id, title, created from message where parent='$parentid'";
if (!(dbresult = pg_exec($dblink, $Query))
  print ("couldn't connect!");
while($row = pg_fetch_object($dbResult, $row))
print ("<LI>($row->created) <A HREF=\"");
print ("PHP_SELF?id=$row->id\">");
print ("$row->title</A><br>\n");


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-08 15:49 UTC]
object pg_fetch_object (int result, int row [, int result_type])

You have to specify the row to return, user error.

/* Note your typo in (!(dbresult .. and the diff case in variables*/
$numrows = pg_numrows($dbresult);
for ($i=0;$i<=$numrows) {
$row = pg_fetch_object($dbresult, $i);
/* etc */
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jun 07 10:01:24 2020 UTC