JasonDFR
10-08-2008, 06:27 PM
I have two tables.
One called USERS, one called USER_INFO
USERS has columns `user_id`, `email`, `pass_word`, `active`, `date_created`
USER_INFO has columns `user_id`, `first_name`, `last_name`, `department`, `gender`
My question: When a new user provides the required information, how do I write the SQL queries to ensure that the user_id for in both tables is the same, thus linking first_name, last_name, etc, TO email, pass_word, etc.
INSERT into `users` (`email`, `pass_word`, `active`) VALUES ('$email', '$first_name', etc) will put the information into the USERS table, but now I need to put the rest of the information into the USER_INFO table while ENSURING that the `user_id` is the same for both tables.
`user_id` in the USERS table is auto_increment and primary key.
I know a bit about this stuff, but for some reason I can't get my head around this issue.
Thanks a lot!
JasonDFR
One called USERS, one called USER_INFO
USERS has columns `user_id`, `email`, `pass_word`, `active`, `date_created`
USER_INFO has columns `user_id`, `first_name`, `last_name`, `department`, `gender`
My question: When a new user provides the required information, how do I write the SQL queries to ensure that the user_id for in both tables is the same, thus linking first_name, last_name, etc, TO email, pass_word, etc.
INSERT into `users` (`email`, `pass_word`, `active`) VALUES ('$email', '$first_name', etc) will put the information into the USERS table, but now I need to put the rest of the information into the USER_INFO table while ENSURING that the `user_id` is the same for both tables.
`user_id` in the USERS table is auto_increment and primary key.
I know a bit about this stuff, but for some reason I can't get my head around this issue.
Thanks a lot!
JasonDFR