pg_fetch_all
pg_fetch_all returns an array that contains all rows (records) in the PgSql\Result instance.
Note:
This function sets NULL fields to the PHP null value.
Parameters
- result
-
An PgSql\Result instance, returned by pg_query, pg_query_params or pg_execute(among others).
- mode
-
An optional parameter that controls how the returned array is indexed. mode is a constant and can take the following values: PGSQL_ASSOC, PGSQL_NUM and PGSQL_BOTH. Using PGSQL_NUM, pg_fetch_all will return an array with numerical indices, using PGSQL_ASSOC it will return only associative indices while PGSQL_BOTH, the default, will return both numerical and associative indices.
Return Values
An array with all rows in the result. Each row is an array of field values indexed by field name.
Changelog
Version | Description |
8.1.0 | The result parameter expects an PgSql\Result instance now; previously, a resource was expected. |
7.1.0 | The mode parameter was added. |