Answer the question
In order to leave comments, you need to log in
How to write data to 2 related tables at once?
PDO MYSQL
Guys how can I send data to several related tables at once?
There is a form with the usual data Field1 Field 2 and photos.
Fields (1 and 2) must be sent to 1 table, and photos to the 2nd table.
I know that you need to first send the Fields to table 1 and get an id, then insert this id into table 2 with a photo so that they are connected.
But how can this be implemented? Does anyone have any examples
Answer the question
In order to leave comments, you need to log in
What DB what driver?
If via PDO methods exec for INSERT after lastInsertId to get ID after exec INSERT for second
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question