in reply to Perl msyql last_insert_id works once?

The availability of ->last_insert_id very much depends on your DBD.

I'm not sure what MySQL states what should happen for insertid within a transaction, so maybe there is a hint in the MySQL documentation.

Maybe one of your insert statements fails and you don't log the error output? You seem to have two/three placeholders but only pass in one/two values to the do statement?