G
G
Governor2018-02-19 20:29:22
MySQL
Governor, 2018-02-19 20:29:22

How to write the last AUTO_INCREMENT number to another table?

There is a user table, which stores user data, with fields:

ID(default AUTO_INCREMENT), login, pass, name, email, birthday

You also need to store the user registration date, but this information is almost never used, so I decided to put it in a separate reg_date table, where there are 2 fields:
user_id, date(default CURRENT_TIMESTAMP)
How to add an entry to the USER table during registration, get the ID value from there, and add this ID to the table reg_date ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Papa, 2018-02-19
@Mr-Governor

Trigger, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question