Re: Accessing last inserted record in a PSQL Database table

From: Date: Mon, 26 Nov 2007 23:55:56 +0000
Subject: Re: Accessing last inserted record in a PSQL Database table
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-44361@lists.php.net to get a copy of this message
kdealba@uaaan.mx wrote:
I need to access the last inserted record in a postgresql database table from php. I connect to the db using pg_connect I construct the query string, and I use pg_query to send the query. I get the record inserted, of course. One of the fields, which is my primary key, is an autoincrement field. I need to fetch this value. Any idea? I would really apreciate your helping me.
select currval('sequence_name') as 'last_id'; -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#44361) next »