[PHP-DB] Accessing last inserted record in a PSQL Database table

2007-11-26 Thread [EMAIL PROTECTED]
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



Re: [PHP-DB] Accessing last inserted record in a PSQL Database table

2007-11-26 Thread Chris

[EMAIL PROTECTED] 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