Answer the question
In order to leave comments, you need to log in
How to add data to database?
There is a database from four tables. The order_processing table contains the orders being processed. The order ID is generated automatically using an increment. Order positions are added to the order_position table. How to correctly add information to two tables at once, without knowing under what number the order was created?
insert into order_processing(idUser) values (2)
insert into order_position(idOrder,idProduct,amount) values(1,2,13)
Answer the question
In order to leave comments, you need to log in
If MySQL
INSERT .... ;
SET @ID = LAST_INSERT_ID() ;
INSERT ... VALUES (@ID, ...) ;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question