Current location: Hot Scripts Forums » Programming Languages » PHP » Linking tables (help!)


Linking tables (help!)

Reply
  #1 (permalink)  
Old 07-20-04, 09:56 PM
SoulieBaby SoulieBaby is offline
New Member
 
Join Date: Jul 2004
Location: Australia
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question Linking tables (help!)

Hey everyone..

I've got a MySQL database 'casablanca' with the following 4 tables:

- gradereports
- contactinfo
- academic
- yearlytotal

All of them have different fields, the only fields the same for all 4 is "ID", "First Name" and "Last Name". The ID is an auto number, however it's different for all - I don't know how to make the ID number the same for the same person (if that makes sense).

Anyway, this is my first database, but what I need to do is to create a table where you'd select a students name, then their information from all 4 tables will be shown.

Is that possible? And what would be the best way to go about it? (Please in lamer terms, I'm still very new to this whole PHP/MySQL thing heehee)

Any help would be greatly appreciated!
Reply With Quote
  #2 (permalink)  
Old 07-20-04, 10:15 PM
kvnband kvnband is offline
Wannabe Coder
 
Join Date: Jun 2003
Posts: 242
Thanks: 0
Thanked 0 Times in 0 Posts
OK, well, the thing is....You really don't need to have their ID, first name, and last name in each table. It would be better if you had, say, 5 tables,

information|gradereports|contactinfo|academic|year lytotal


In information, you store the user's ID, First Name, And Last Name. Then in gradereports, contactinfo, academic, yearlytotal, you have it referenced like

ID|gradereportsinfo
ID|contactinfo
ID|academic
ID|yearlytotal

I'm trying not to be confusing here, but what I'm saying is that you're making it too hard on yourself. Maybe someone else here can explain it better

Happy coding,
Kevin
Reply With Quote
  #3 (permalink)  
Old 07-21-04, 02:15 AM
SoulieBaby SoulieBaby is offline
New Member
 
Join Date: Jul 2004
Location: Australia
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Ahh ok cool, i'll set up another table.. sorry to sound dumb, but what would i do to reference the tables? (as i said earlier, i'm all new to this) lol
Reply With Quote
  #4 (permalink)  
Old 07-28-04, 09:41 PM
SoulieBaby SoulieBaby is offline
New Member
 
Join Date: Jul 2004
Location: Australia
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Anyone?
Reply With Quote
  #5 (permalink)  
Old 07-28-04, 10:04 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
It's been a week, guess not.

http://www.php.net

http://www.mysql.com

Have at it.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Time error '3265': linking tables lawdie Visual Basic 2 11-24-05 10:02 PM
Need help counting tables (selected db) DBN PHP 2 05-13-04 02:12 AM
tables joins - 3 tables lordmerlin ASP 1 03-18-04 08:20 AM
Linking two tables within a db Ported Valhalla PHP 2 10-14-03 10:36 AM
script that measures height of tables and vertically aligns nested tables amj01 Script Requests 1 07-04-03 01:20 PM


All times are GMT -5. The time now is 04:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.