in reply to Finding last inserted id through DBI

One of my favorite ways is:
$uniqueid= time . $$; my $sql <<EOF; INSERT INTO FOO (a,b,c) VALUES ($uniqueid,$foo,$bar); EOF $dbh->do($sql); $sql="SELECT a,key from FOO where a=$uniqueid; my $sth=$dbh->prepare_cached($sql); $sth->execute(); my $cursor = $sth->fetchrow_hashref; my $id=$cursor{"key};

--
Jay "Yohimbe" Thorne, alpha geek for UserFriendly