Sorry i had thought that since i was using DBI that the database would not be a factor. I'm using mysql though.
I've tried using the LAST_INSERT_ID() function suggested on mysql website but havn't gotten it to work.
$sth=$dbh->prepare("UPDATE history SET history_conf = LAST_INSERT_ID() WHERE history_id = LAST_INSERT_ID()")