#46161 [Opn->Bgs]: pg_fetch_result not going to next row
| From: | tularis@php.net | Date: | Tue, 23 Sep 2008 14:11:37 +0000 |
| Subject: | #46161 [Opn->Bgs]: pg_fetch_result not going to next row | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1168@lists.php.net to get a copy of this message | ||
ID: 46161
Updated by: tularis@php.net
Reported By: analogue at glop dot org
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: Debian GNU/Linux
PHP Version: 5.2.6
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
please use the php.general mailinglist for support, NOT the bugs
system.
You're misunderstanding the documentation. You're asking again and
again for row 0, if you _do not provide_ the argument, you will get the
next. So:
echo pg_fetch_result($result, 0)."\n";
echo pg_fetch_result($result)."\n";
echo pg_fetch_result($result)."\n";
would result in the behaviour as you expected.
Previous Comments:
------------------------------------------------------------------------
[2008-09-23 13:14:56] analogue at glop dot org
Happens on PHP 5.2.6, forgot to specify it.
------------------------------------------------------------------------
[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