Query: pg_fetch_all
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
PG_FETCH_ALL(3) PG_FETCH_ALL(3) pg_fetch_all - Fetches all rows from a result as an arraySYNOPSISarray pg_fetch_all (resource $result)DESCRIPTIONpg_fetch_all(3) returns an array that contains all rows (records) in the result resource. Note This function sets NULL fields to the PHP NULL value.PARAMETERSo $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).RETURN VALUESAn array with all rows in the result. Each row is an array of field values indexed by field name. FALSE is returned if there are no rows in the result, or on any other error.EXAMPLESExample #1 PostgreSQL fetch all <?php $conn = pg_pconnect("dbname=publisher"); if (!$conn) { echo "An error occurred. "; exit; } $result = pg_query($conn, "SELECT * FROM authors"); if (!$result) { echo "An error occurred. "; exit; } $arr = pg_fetch_all($result); print_r($arr); ?> The above example will output something similar to: Array ( [0] => Array ( [id] => 1 [name] => Fred ) [1] => Array ( [id] => 2 [name] => Bob ) )SEE ALSOpg_fetch_row(3), pg_fetch_array(3), pg_fetch_object(3), pg_fetch_result(3). PHP Documentation Group PG_FETCH_ALL(3)
Related Man Pages |
---|
pg_affected_rows(3) - php |
pg_fetch_all_columns(3) - php |
pg_fetch_assoc(3) - php |
pg_fetch_row(3) - php |
pg_field_is_null(3) - php |
Similar Topics in the Unix Linux Community |
---|
Array not initializing |
array error |
Array and field separator |
Store the output values in array |
Need to have output of AWK array in one line |