in reply to Re: Re: DBI: last insert id
in thread DBI: last insert id

Consult the DBD::mysql POD (via "perldoc DBD::mysql"). It tells of an easier way. After an insert,
$dbh->{mysql_insertid}
holds the most recently assigned id. Your code might then be rewritten as
my $id = $dbh->{mysql_insertid}; $sth = $dbh->prepare(<<"SQL"); UPDATE history SET history_conf = ? WHERE history_id = ? SQL $sth->execute($id, $id);