php man page for pg_fetch_assoc

Query: pg_fetch_assoc

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

PG_FETCH_ASSOC(3)														 PG_FETCH_ASSOC(3)

pg_fetch_assoc - Fetch a row as an associative array

SYNOPSIS
array pg_fetch_assoc (resource $result, [int $row])
DESCRIPTION
pg_fetch_assoc(3) returns an associative array that corresponds to the fetched row (records). pg_fetch_assoc(3) is equivalent to calling pg_fetch_array(3) with PGSQL_ASSOC as the optional third parameter. It only returns an associa- tive array. If you need the numeric indices, use pg_fetch_row(3). Note This function sets NULL fields to the PHP NULL value. pg_fetch_assoc(3) is NOT significantly slower than using pg_fetch_row(3), and is significantly easier to use.
PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $row - Row number in result to fetch. Rows are numbered from 0 upwards. If omitted or NULL, the next row is fetched.
RETURN VALUES
An array indexed associatively (by field name). Each value in the array is represented as a string. Database NULL values are returned as NULL. FALSE is returned if $row exceeds the number of rows in the set, there are no more rows, or on any other error.
EXAMPLES
Example #1 pg_fetch_assoc(3) example <?php $conn = pg_connect("dbname=publisher"); if (!$conn) { echo "An error occurred. "; exit; } $result = pg_query($conn, "SELECT id, author, email FROM authors"); if (!$result) { echo "An error occurred. "; exit; } while ($row = pg_fetch_assoc($result)) { echo $row['id']; echo $row['author']; echo $row['email']; } ?>
SEE ALSO
pg_fetch_row(3), pg_fetch_array(3), pg_fetch_object(3), pg_fetch_result(3). PHP Documentation Group PG_FETCH_ASSOC(3)
Related Man Pages
fbsql_fetch_array(3) - php
pg_fetch_array(3) - php
pg_fetch_object(3) - php
pg_field_prtlen(3) - php
sqlsrv_next_result(3) - php
Similar Topics in the Unix Linux Community
extracting a row from a file
Send email for each row in a result set
how to spilit a row into fields and store the field content to the array
How to print array values whose name is inside a variable
Setting script exit code