Ok im not sure wether this counts as a php question or a database question, but ill put it here anyway.

I have two fields in a database, one of which holds a foreign key that is a primary key from the other:
USER(user_ID, username, password)
USER_INFORMATION(user_info_ID, user_ID, name, DOB, email, address)

when i put data into the database from a form on a page, how can i make it so that the right user_ID goes into the USER_INFORMATION table.

Hope i put that clear enough

Recommended Answers

All 3 Replies

I forgot to mention before that user_ID is set to auto_increment in the USER table

Do a SELECT to find the user_id for the current user in the USER table. Assign the user_ID to a variable, $user_ID. Now do your UPDATE on the USER_INFORMATION table using WHERE user_ID='$user_ID'

commented: good solution +1

good idea, thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.