Edit report at https://bugs.php.net/bug.php?id=48721&edit=1

 ID:                 48721
 Updated by:         [email protected]
 Reported by:        eric dot schultz at cyvon dot com
 Summary:            Added parameter to pg_fetch_all allowing index to be
                     column based
 Status:             Open
 Type:               Feature/Change Request
 Package:            PostgreSQL related
 Operating System:   Linux
 PHP Version:        5.2.10
-Assigned To:        
+Assigned To:        yohgaki
 Block user comment: N
 Private report:     N

 New Comment:

I think I marked the same request as "wont't fix". 
This sounds reasonable.


Previous Comments:
------------------------------------------------------------------------
[2009-06-29 15:31:25] eric dot schultz at cyvon dot com

Description:
------------
I would love if the pg_fetch_all could take a parameter that would (optionally) 
allow the indexing of the resultset to be a column value as opposed to 0-based. 
(as many tables include a primary key/id)

Reproduce code:
---------------
---
>From manual page: function.pg-fetch-all
---
I find myself doing the following VERY often:

$res = pg_query("Select * from set_options");
if(!$res) return(0);
$ret = array();
while($r = pg_fetch_assoc($res)){
    $ret[$r['id']] = $r; }
return($ret);


Expected result:
----------------
above produces an associative array indexed on the "id" column. Would like this 
built into the pg_fetch_all

Actual result:
--------------
see above


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=48721&edit=1

Reply via email to