Home > PHP > Function > PostgreSQL > pg_last_error()

pg_last_error()

pg_last_error - Get the last error message string of a connection

Syntax

string pg_last_error (resource $connection)

Arguments

  • connection - PostgreSQL database connection resource. When connection is not present, the default connection is used. The default connection is the last connection made by pg_connect() or pg_pconnect().

Description

pg_last_error() returns the last error message for a given connection.

Version

PHP 4.2.0, 5

Return value

A string containing the last error message on the given connection, or FALSE on error.