[thelist] PostgreSQL mysql_insert_id equivalent ?

Ivo P ipletikosic at gmail.com
Mon Nov 14 19:23:42 CST 2005


Check this out

http://www.postgresql.org/files/documentation/books/aw_pgsql/node76.html

when you specify a column in a table as SERIAL it will become use a
sequence that autoincrements on every insert .

Following the example in the link above, you would add a row with:

INSERT INTO customer (name)  VALUES ('Steve Bissonnette');

and would get the inserted customer_id with:

select currval('customer_customer_id_seq');





On 11/9/05, Steve Bissonnette <steve at plankdesign.com> wrote:
> Hi,
>
> I¹m looking for some code that will best give me the last INSERTED ID in a
> PostgreSQL database using PHP ?
>
> It would be the equivalent to the function - mysql_insert_id().
> http://ca3.php.net/mysql_insert_id
>
> Is there a simple way to do this ?
>



More information about the thelist mailing list