Answer the question
In order to leave comments, you need to log in
Relationship between two tables?
There are users and settings tables.
The users table has an id column with auto-increment
How to make it so that when adding a record to the users table, a record with the same id is created in the settigns table at the same time?
Previously, I used the fact that creating a record in one of the tables, I recognized the last_insert_id, and then created a record in another table substituting this id. But did I do it right? How to implement it more correctly?
Answer the question
In order to leave comments, you need to log in
What is the purpose of the record? Well, when you receive a request to save the settings, then write it down (an upsert-analogue in mysql, like on duplicate key), and substitute the defaults.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question