Another way is to create the query something like "INSERT into TABLE_NAME VALUES(other_table_id=LAST_INSERT_ID(),column2='value2')"
I've not used this in a heavy-load server environment yet, but I believe it keeps the last insert id for your specific session (i.e. another user performing an insert between your 1st and 2nd query will not pollute the 2nd query).