pg_getlastoid

(PHP 3, PHP 4 >= 4.0.0)

pg_getlastoid -- Returns the last object identifier

Description

int pg_getlastoid (int result_id)

pg_getlastoid() can be used to retrieve the oid assigned to an inserted tuple if the result identifier is used from the last command sent via pg_exec() and was an SQL INSERT. This function will return a positive integer if there was a valid oid. It will return -1 if an error occured or the last command sent via pg_exec() was not an INSERT.