943,852 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 983
  • PHP RSS
Jan 24th, 2008
0

Multiple database tables

Expand Post »
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
Similar Threads
Reputation Points: 11
Solved Threads: 6
Junior Poster in Training
hooray is offline Offline
62 posts
since Jan 2008
Jan 24th, 2008
0

Re: Multiple database tables

I forgot to mention before that user_ID is set to auto_increment in the USER table
Reputation Points: 11
Solved Threads: 6
Junior Poster in Training
hooray is offline Offline
62 posts
since Jan 2008
Jan 24th, 2008
1

Re: Multiple database tables

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'
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007
Jan 24th, 2008
0

Re: Multiple database tables

good idea, thanks
Reputation Points: 11
Solved Threads: 6
Junior Poster in Training
hooray is offline Offline
62 posts
since Jan 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Having a bit of trouble figuring out my image upload script
Next Thread in PHP Forum Timeline: Help Please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC