in reply to last_insert_id did not work

->last_insert_id is a method of the database handle, not of the statement handle (see last_insert_id). So you want to call it on the database handle:

$dbh->last_insert_id()

Replies are listed 'Best First'.
Re^2: last_insert_id did not work
by choroba (Cardinal) on Mar 27, 2021 at 14:35 UTC
    It depends on the driver. DBD::MariaDB supports is as a method of the statement handle, too. I've recently recommended it.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^2: last_insert_id did not work
by bizactuator (Sexton) on Mar 27, 2021 at 07:34 UTC
    Got it. Thank you!!

    I am trying this right now: $sth->{mysql_insertid};
    I'll try that if this does not work.

    Thanks for the help.

    -Richard