php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11130 pg_fetch_array returning twice the number of connections.
Submitted: 2001-05-26 12:36 UTC Modified: 2001-05-26 15:25 UTC
From: excalibur at hub dot org Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 4.0.5 OS: FreeBSD 4.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: excalibur at hub dot org
New email:
PHP Version: OS:

 

 [2001-05-26 12:36 UTC] excalibur at hub dot org
I've tested extensively to figure out if this is a bug or not, but since I installed 4.0.5 on my system my queries have been returning twice the number of columns as it should. The table I am selecting from has 3 rows and 3 columns, however pg_fetch_array returns 6 columns (it creates duplicates). My Query is a simple "SELECT * FROM table ORDER BY column request and I am running 7.1 of PostgreSQL, I have already verified that PostgreSQL is not causing the problem. pg_numfields returns a 3 so I have a work around, but using pg_fetch_array is SOOO convienent :>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-26 12:38 UTC] excalibur at hub dot org
Forgot to add my code..

  function select($query) {
   if (!$this->get_pgsql_connection_status()) {
    $this->open();
   }

   if ($this->get_pgsql_connection_status()) {
    $result_query = pg_exec($this->pgsql_dbh, $query);
    if (isset($result_query) && pg_numrows($result_query) > 0) {
     $result_array = array();
     for ($i = 0; $i < pg_numrows($result_query); $i++) {
      $result_array[$i] = pg_fetch_array($result_query, $i);
     }

     $this->close();
     return $result_array;
    }

    $this->close();
   }

   return false;
  }
 [2001-05-26 15:25 UTC] derick@php.net
This is not a bug, see this in the manual: (www.php.net/pg_fetch_array)

   Pg_fetch_array() is an extended version of pg_fetch_row(). In addition
   to storing the data in the numeric indices of the result array, it
   also stores the data in associative indices, using the field names as
   keys.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 15:01:33 2024 UTC