From: eric dot schultz at cyvon dot com Operating system: Linux PHP version: 5.2.10 PHP Bug Type: Feature/Change Request Bug description: Added parameter to pg_fetch_all allowing index to be column based
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 bug report at http://bugs.php.net/?id=48721&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48721&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48721&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48721&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48721&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48721&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48721&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48721&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48721&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48721&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48721&r=support Expected behavior: http://bugs.php.net/fix.php?id=48721&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48721&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48721&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48721&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48721&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48721&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48721&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48721&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48721&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48721&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48721&r=mysqlcfg