Add Record to DB and Return Auto_Increment ID?

From: Date: Sun, 21 Oct 2001 17:15:12 +0000
Subject: Add Record to DB and Return Auto_Increment ID?
Groups: php.db 
Request: Send a blank email to php-db+get-13576@lists.php.net to get a copy of this message
Hi. I'm creating a class mapped to the functions of a guestbook. Each guestbook submission becomes an entry in a db table. I am using the DB Pear class. I'm new to PHP and my question is this: What is the best way to create a method that adds a new guestbook entry and returns its auto_increment id. I could use an "Insert" statement and then a "Select" statement to find out what id was added for the record, but that seems a little inefficient. Any ideas? Thanks for any help. Much appreciated, Brett

« previous php.db (#13576) next »