Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Olá cog. ;)
I remember having problems with last_insert_id to. Ultimately I was able to get way with something like this. $sth->execute( $entries{'a'}, $entries{'b'}, $entries{'b'} ); my $last_insert_id =$dbh->{q{mysql_insertid}}; It seems though that you can also use something like this: $dbh->do('INSERT INTO table_name ...'); my $id = $dbh->last_insert_id(undef, undef, qw(table_name your_table_id)) or die "no insert id?"; About the select, try running the select just after you've inserted or after you made the call to last_insert_id whilst inside the transaction to make sure last_insert_id is returning the right values. In reply to Re: DBI and last_insert_id
by G@SP@R
|
|