in reply to Perl/DBI autoincrement

Also, if you're using DBI you can get the id of the last inserted record by calling:
$new_id = $sth->{mysql_insertid};
Keep in mind that retrieving the auto increment id needs to be the first thing you do after inserting the record. Also either exclude the primary key from the insert statement or pass NULL as its value.

Here's the MySQL documentation page: http://www.mysql.com/doc/en/Perl_DBI_Class.html

Replies are listed 'Best First'.
Re: Re: Perl/DBI autoincrement
by Digitus (Novice) on Jul 18, 2003 at 13:16 UTC
    You guys are beautiful. I used a mix of just altering the table to make the primary key increment, and the fetch statement offered here. We're up and running. Thanks for the help!!

    Digitus