MySQL Forums
Forum List  »  Newbie

Re: Inserting data into related tables
Posted by: Peter Brawley
Date: September 07, 2022 11:22AM

If you're inserting user and order at the same time, insert the user first, query last_insert_id() to find the id that was generated, then populate orders.user_id with that value when inserting the order.

Edited 1 time(s). Last edit at 09/07/2022 01:18PM by Peter Brawley.

Options: ReplyQuote

Written By
September 06, 2022 11:02PM
Re: Inserting data into related tables
September 07, 2022 11:22AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.