|
Home
iRate! IceMelon IM Tutorials Headlines CoolSites PHP Functions |
|
Most Referenced Functions » google_pagerank() » preg_replace() » imagecreatefrompng() » site_pageranks() » imagepng() » imagedestroy() » imagestring() » imagecolorallocate() » htmlentities() » preg_match() » fopen() » header() » getimagesize() » preg_match_all() » session_start() » htmlspecialchars() » ob_start() » ob_flush() » strstr() » flush() » strpos() » setcookie() » str_replace() » array2vars() » nl2br() » preg_split() » ereg() » ereg_replace() » urlencode() » readgzfile() Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m. |
PHP Functions
Function: pg_last_oid (PHP 4 >= 4.2.0, PHP 5) pg_last_oid -- Returns the last row's OIDDescriptionstring pg_last_oid ( resource result )pg_last_oid() is used to retrieve the OID assigned to an inserted row. OID field became an optional field from PostgreSQL 7.2 and will not be present by default in PostgreSQL 8.1. When the OID field is not present in a table, the programmer must use pg_result_status() to check for successful insertion. To get the value of a SERIAL field in an inserted row, it is necessary to use the PostgreSQL CURRVAL function, naming the sequence whose last value is required. If the name of the sequence is unknown, the pg_get_serial_sequence PostgreSQL 8.0 function is necessary. Note: This function used to be called pg_getlastoid() . Parameters
result PostgreSQL query result resource, returned by pg_query() , pg_query_params() or pg_execute() (among others). Return ValuesA string containing the OID assigned to the most recently inserted row in the specified connection , or FALSE on error or no available OID. Examples
Example 1. pg_last_error() example
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
$res1 = pg_query("CREATE TABLE test (a INTEGER) WITH OIDS");
$res2 = pg_query("INSERT INTO test VALUES (1)");
$oid = pg_last_oid($res2);
?>
Related Function(s) |