Re: Accessing last inserted record in a PSQL Database table

Re: Accessing last inserted record in a PSQL Database table

am 27.11.2007 00:55:56 von dmagick

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/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Accessing last inserted record in a PSQL Database table

am 27.11.2007 01:03:49 von kdealba

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.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php