Trying to get the last inserted ID

"Vance E. Neff" <[email protected]> Tue, 31 Mar 2009 11:49:44 -0400
Newsgroups gmane.comp.db.mysql.perl
Organization Vance's Consulting Co.
Message-ID <[email protected]>
Hello,

I have inserted a new row into a table that has an auto incrementing key.

For some reason, I don't seem to be able to retrieve it after it is created.
I tried these two statements:
$LoginID = $dbh->last_insert_id( "", "", "Logins", "LoginID" );
and
$LoginID = $dbh->{'mysql_insertid'};

in both cases, $LoginID comes back undefined.
I tried before the COMMIT and after with the same results.  Note that 
auto commit is currently turned on, so my commits should have anything 
to do with anything.

What am I doing wrong?

Note that I have verified that the key is being created with the 
expected values.

Vance



-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]