Home > PHP > Function > PostgreSQL > pg_update()

pg_update()

pg_update - Update table

Syntax

mixed pg_update (resource $connection, string $table_name, array $data, array $condition, int $options)

Arguments

  • connection - PostgreSQL database connection resource.
  • table_name - Name of the table into which to update rows.
  • data - An array whose keys are field names in the table table_name, and whose values are what matched rows are to be updated to.
  • condition - 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 updated.
  • options - Any number of PGSQL_CONV_OPTS, PGSQL_DML_NO_CONV, PGSQL_DML_EXEC or PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the options then query string is returned.

Description

pg_update() updates records that matches conditionwith data. If optionsis specified, pg_convert() is applied to datawith specified options.

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.