php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26399 function pg_fetch_array() is malfunctioning
Submitted: 2003-11-25 06:16 UTC Modified: 2003-11-25 16:33 UTC
From: elektrik at gmx dot net Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: Irrelevant OS: Linux (SuSe 8.0)
Private report: No CVE-ID: None
 [2003-11-25 06:16 UTC] elektrik at gmx dot net
Description:
------------
The function pg_fetch_array accepts the writing:
pg_fetch_array($result, PGSQL_ASSOC). Standard is PGSQL_BOTH.
With PGSQL_ASSOC I get weard behavior.

Instead of having only associative results, I get an infinite loop of both assoc. and numeric indexes...

Reproduce code:
---------------
$query = "SELECT * FROM table";
$result = pg_query($link, $query);

while( $row = pg_fetch_array($result, PGSQL_ASSOC) )
   print_r($row);

pg_free_result($result);


Expected result:
----------------
["id"] => 1
["name"] => "bla"

Actual result:
--------------
[0] => 1
["id"] => 1
[1] => "bla"
["name"] => "bla"

... infinite loop...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-25 16:33 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Read the manual:
array pg_fetch_array ( resource result [, int row [, int result_type]])
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC