Home > PHP > Function > PostgreSQL > pg_select()

pg_select()

pg_select - Select records

Syntax

mixed pg_select (resource $connection, string $table_name, array $assoc_array, int $options)

Arguments

  • connection - PostgreSQL database connection resource.
  • table_name - Name of the table from which to select rows.
  • assoc_array - An array whose keys are field names in the table table_name, and whose values are the conditions that a row must meet to be retrieved.
  • options - Any number of PGSQL_CONV_FORCE_NULL, PGSQL_DML_NO_CONV, PGSQL_DML_EXEC, PGSQL_DML_ASYNC or PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the options then query string is returned.

Description

pg_select() selects records specified by assoc_arraywhich has field=>value. For a successful query, it returns an array containing all records and fields that match the condition specified by assoc_array.

Version

PHP 4.3.0, 5

Return value

Returns TRUE on success or FALSE on failure. Returns string if PGSQL_DML_STRING is passed via options.