Do the insert missing out auto_increment column and then get it afterwoods 

$key = mysql_insert_id();

This actually is cleared on next database access, there is another function 
that is not (cant remember other function and I may of got them the wrong 
way round).

If you are new to PHP you should look things up in the manual, there is a 
PDF and web searchable version for both MySQL and PHP.  Search for 

Although I am impressed you are using db list not general one ;)


At 07:15 P 21/10/01, Brett Conrad wrote:
>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,
>PHP Database Mailing List (
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

* Ben Edwards                                +352 091 429995 *
* Homepage       *
* i-Contact Progressive Video *
* Smashing the Corporate image *
* Bristol's radical news   *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8   *

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to