Re: last insert ID
| From: | list | Date: | Mon, 03 Jan 2005 15:06:05 +0000 |
| Subject: | Re: last insert ID | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37952@lists.php.net to get a copy of this message | ||
hi
you can use the mysql function LAST_INSERT_ID()
heres the info from the manual:
http://dev.mysql.com/doc/mysql/en/ODBC_and_last_insert_id.html
hope that helps
eoghan
Nathan Mealey wrote:
Is there a PEAR::DB equivalent to the mysql_insert_id()? I can't figure out how to get the primary key ID from the last insert query, without doing a second query (which seems ridiculous). On that same note, are the mysql_insert_id() and pg_last_oid() equivalent? I thought they were, but when I used pg_last_oid() I got some crazy number that was definitely not the last primary key ID. Thanks, Nathan -- Nathan Mealey Director of Operations Cycle-Smart, Inc. P.O. Box 1482 Northampton, MA 01061-1482 nathan@cycle-smart.com (413) 210-7984 (512) 681-7043 Fax