This is an easy problem, but for some reason a little hard to explain typed out. So here's what I'm doing (MSSQL - not by choice...):
TableOne has an autonumber field called "ID"
$query1 = insert into TableOne (info) values (info);
$result1 = mssql_query($query2);
$query2 = select ID from TableOne order by ID desc;
$result2 = mssql_query($query2);
$last_id = mssql_fetch_result($result2,0,'ID');
$query3 = insert into TableTwo (fID, info) values ($last_id, info);
$result3 = mssql_query($query3);
The problem here, I believe, is that it's possible (not very... but this has to be definite) that a row could be inserted between $query2 and $query3 which would make the $last_id inaccurate...
Any suggestions would be appreciated.
Thanks!