PHP 4.0 Bug #7688 Updated: loop with in pg_fetch_object

From: Date: Wed, 08 Nov 2000 14:49:40 +0000
Subject: PHP 4.0 Bug #7688 Updated: loop with in pg_fetch_object
Groups: php.dev 
Request: Send a blank email to php-dev+get-37435@lists.php.net to get a copy of this message
ID: 7688 Updated by: mathieu Reported By: chris.millsaps@wcom.com Status: Closed Bug Type: *Function Specific Assigned To: Comments: 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 */ } Previous Comments: --------------------------------------------------------------------------- [2000-11-08 00:22:14] chris.millsaps@wcom.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!"); exit(); } 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"); showmessages($row->id); } --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7688

« previous php.dev (#37435) next »