The second option is also a bit difficult. Here is the story:
Two tables, orders and order details. We are going to use the orderID as foreign key in order details table.
In the checkout page we have two database manipulations:
Store order summary and store order details. The first one is ok but the second one we miss the orderID field. How can we make it sure that at same time the right orderID inserted in to the both tables?