$cursor = $dbh->prepare("insert into table (a, b) values (?, ?)"); $cursor->execute($a_var, $b_var); #### $id = $dbh->{mysql_insertid};