I'm in the process of coding a multi-instance shopping cart and have developed some doubts about the above mentioned functions infallibility:
People will insert the basic information on a product into a "product" table and the primary key will then be fetched with the mentioned function and used as a foreign key for product options in a "prod_options" table affiliated with the data from the product table.
But question is: If another user - almost simultaneously - also inserts into the main "product" table. Could the wrong prod_id then end up being fetched for the first users' prod-options, so a set of product options somehow end up being affiliated with another users' product? If yes, what is the best/most efficient surefire way to prevent this from happening?
Thx for reading.