User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 401,495 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,170 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 573 | Replies: 3
Reply
Join Date: Mar 2008
Posts: 22
Reputation: eparse is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
eparse eparse is offline Offline
Newbie Poster

retrieve data frm 2 tables

  #1  
Mar 17th, 2008
hi all experts here, i am currently doing my web project using PHP and facing no clue for the database connection between 3 tables....here it is:

i'd created 3 tables, one keeps users' username, password, and id....the other keeps the details that user input from a form...both contain a common username. How can i connect both the table and retrieve (SELECT * from ...... ) the whole row of data for the same username? thanks...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,218
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 10
Solved Threads: 270
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: retrieve data frm 2 tables

  #2  
Mar 18th, 2008
You need a primary key (sometimes secondary key is usefull but your DB is small so no need) by which you can assosiate data between tables. So if your user table has an UNIQUE ID you should use that in other tables and this way you can link the data between them
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Dec 2007
Posts: 112
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
mwasif mwasif is offline Offline
Junior Poster

Re: retrieve data frm 2 tables

  #3  
Mar 18th, 2008
To clarify, you need to use JOIN to get data from all 3 tables.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,218
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 10
Solved Threads: 270
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: retrieve data frm 2 tables

  #4  
Mar 18th, 2008
I do not think he wants to join 3 tables together, I believe eparse wants to associate data from each table
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MySQL Forum

All times are GMT -4. The time now is 2:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC