#46161 [Opn]: pg_fetch_result not going to next row
| From: | analogue at glop dot org | Date: | Tue, 23 Sep 2008 13:14:56 +0000 |
| Subject: | #46161 [Opn]: pg_fetch_result not going to next row | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1167@lists.php.net to get a copy of this message | ||
ID: 46161
User updated by: analogue at glop dot org
Reported By: analogue at glop dot org
Status: Open
Bug Type: Documentation problem
Operating System: Debian GNU/Linux
-PHP Version: Irrelevant
+PHP Version: 5.2.6
New Comment:
Happens on PHP 5.2.6, forgot to specify it.
Previous Comments:
------------------------------------------------------------------------
[2008-09-23 13:13:36] analogue at glop dot org
Description:
------------
As stated in the documentation from http://php.net/pg_fetch_result when
used with 2 parameters, pg_fetch_result should go to the next row when
called back.
Parameter row: "Row number in result to fetch. Rows are numbered from 0
upwards. If omitted, next row is fetched."
But when I try to call it multiple times, I always get the same first
row.
Is it a bug or am I misunderstanding the documentation ?
Thanks for looking into it.
Reproduce code:
---------------
$conn = pg_connect($conn_string);
$query = 'SELECT name FROM pg_settings';
$result = pg_query($conn, $query);
echo pg_fetch_result($result, 0)."\n";
echo pg_fetch_result($result, 0)."\n";
echo pg_fetch_result($result, 0)."\n";
pg_close($conn);
Expected result:
----------------
add_missing_from
allow_system_table_mods
archive_command
Actual result:
--------------
add_missing_from
add_missing_from
add_missing_from
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46161&edit=1