Multiple database tables

Thread Solved

Join Date: Jan 2008
Posts: 62
Reputation: hooray is an unknown quantity at this point 
Solved Threads: 6
hooray hooray is offline Offline
Junior Poster in Training

Multiple database tables

 
0
  #1
Jan 24th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 62
Reputation: hooray is an unknown quantity at this point 
Solved Threads: 6
hooray hooray is offline Offline
Junior Poster in Training

Re: Multiple database tables

 
0
  #2
Jan 24th, 2008
I forgot to mention before that user_ID is set to auto_increment in the USER table
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Multiple database tables

 
1
  #3
Jan 24th, 2008
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'
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 62
Reputation: hooray is an unknown quantity at this point 
Solved Threads: 6
hooray hooray is offline Offline
Junior Poster in Training

Re: Multiple database tables

 
0
  #4
Jan 24th, 2008
good idea, thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC