Home > PHP > Function > PostgreSQL > pg_fetch_assoc()

pg_fetch_assoc()

pg_fetch_assoc - Fetch a row as an associative array

Syntax

array pg_fetch_assoc (resource $result, int $row)

Arguments

  • result - PostgreSQL query result resource, returned by pg_query(), pg_query_params() or pg_execute() (among others).
  • row - Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, next row is fetched.

Description

pg_fetch_assoc() returns an associative array that corresponds to the fetched row (records).

Version

PHP 4.3.0, 5

Return value

An array indexed associatively (by field name). Each value in the array is represented as a string. Database NULLvalues are returned as NULL.