# A little idea about pg_fetch_all ( resource result)

- Thread: https://externals.io/message/7509
- Original archive: https://news-web.php.net/php.internals/7509
- Started by prasek@silesia.cz on 2004-02-03T16:09:18+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7509 — prasek@silesia.cz — 2004-02-03T16:09:18+00:00

URL: https://externals.io/message/7509#7509

In most databases an queries , there is  primary key/unique constraint so i suggest to  enhnace  function  pg_fetch_all ( resource result)

to 

pg_fetch_all ( resource result,[string key_column_name]) bz adding a second optional parameter,  so anybody can access all  returned data like this:

$data= pg_fetch_all ($resource,$key_column_name]);
$column=$data['value of the key, specified in 2nd argument to pg_fetch_all' ]['name of the column'];

ie all tuples/lines  from result can be accessed via associative array, with key is the value of specified column.

Yes, I think it can be done by wery simle code too, but....
