Hello,
I am using DBI Version 1.42 on OSX, accessing a MySQL database on Linux (Mandrake)

Previously I have been using DBI with mysql on Linux, I always used
        $sth=$dbh->prepare("INSERT INTO ......");
        $sth->execute() or die();
        $ID = $sth->{insertid};
To obtain the last insert id.


But this does not seem to work on OSX with DBI 1.42 there is no error it just Returns undef.
        The documentation has
        $ID = $dbh->last_insert_id();

The parameters are ignored for MySQL, but this does not work either

I found on the net
        $ID = $dbh->{'mysql_insertid'};

Why dont the other two work, and is there a more portable method to obtain the last insert id.

Thank you
Stuart Gall

Reply via email to