note 29988 added to function.pg-last-oid
| From: | webmaster at gamecrash dot net | Date: | Mon, 03 Mar 2003 12:29:53 +0000 |
| Subject: | note 29988 added to function.pg-last-oid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44774@lists.php.net to get a copy of this message | ||
You could use this to get the last insert id...
CREATE TABLE test (
id serial,
something int not null
);
This creates the sequence test_id_seq. Now do the following after inserting something into table
test:
INSERT INTO test (something) VALUES (123);
SELECT currval('test_id_seq') AS lastinsertid;
lastinsertid should contain your last insert id.
--
http://www.php.net/manual/en/function.pg-last-oid.php
http://master.php.net/manage/user-notes.php?action=edit+29988
http://master.php.net/manage/user-notes.php?action=delete+29988
http://master.php.net/manage/user-notes.php?action=reject+29988