#46161 [Bgs]: pg_fetch_result not going to next row

From: Date: Tue, 23 Sep 2008 15:13:01 +0000
Subject: #46161 [Bgs]: pg_fetch_result not going to next row
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1173@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: Bogus Bug Type: Documentation problem Operating System: Debian GNU/Linux PHP Version: 5.2.6 New Comment: I'm sorry, you're right, my example was incorrect. But PLEASE consult with php.general or any other source to find out how to do what you're trying to do. And if you all figure out it IS a bug, and figure out what the documentation SHOULD say, feel free to tell us. Previous Comments: ------------------------------------------------------------------------ [2008-09-23 15:10:32] analogue at glop dot org I mean there aren't any square bracket [] around the second and third parameters. ------------------------------------------------------------------------ [2008-09-23 15:09:41] analogue at glop dot org Sorry but in the documentation, there is no mention of a way to call pg_fetch_result with only one parameter, so I think this is a real documentation problem. ------------------------------------------------------------------------ [2008-09-23 14:11:37] tularis@php.net 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. ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#1173) next »