note 31568 rejected from function.pg-last-oid by rioter
| From: | rioter@php.net | Date: | Sat, 26 Apr 2003 12:41:19 +0000 |
| Subject: | note 31568 rejected from function.pg-last-oid by rioter | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47137@lists.php.net to get a copy of this message | ||
--------------------------------------------------------
You couldn't this. Becouse test_id_seq may be changed?
--------------------------------------------------------
>>> 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.
--------------------------------------------------------
You couldn't this. Becouse test_id_seq may be changed?
--------------------------------------------------------