note 29654 added to function.pg-last-oid

From: Date: Thu, 20 Feb 2003 11:54:17 +0000
Subject: note 29654 added to function.pg-last-oid
Groups: php.notes 
Request: Send a blank email to php-notes+get-44250@lists.php.net to get a copy of this message
Hm ok. In MySQL you could have an AUTO_INCREMENT column and not specify a value for it in an insert statement - say you had: recordid field1 field2 ------------------- 1 one two And you wanted to add a record with a value of field1 as 'three', and field2 as 'four'. Well you could do that with: insert into table (field1, field2) values ('three', 'four') And then you could call mysql_insert_id() and it would give you the value it had automatically assigned to the recordid field. This pretty much guarantees that you will never accidentally attempt to create a record with the same value in the key field as another. Can you also do that with this function and an OID field in PostgreSQL? It would be good to be able to know the value it has used for the OID field, becuase I may want to use that value in an INSERT query to another table straight afterwards. -- http://www.php.net/manual/en/function.pg-last-oid.php http://master.php.net/manage/user-notes.php?action=edit+29654 http://master.php.net/manage/user-notes.php?action=delete+29654 http://master.php.net/manage/user-notes.php?action=reject+29654

« previous php.notes (#44250) next »