Linking Multiple Tables togetyher in MySQL?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Elmseeker
Forum Contributor
Posts: 132
Joined: Sun Dec 22, 2002 5:48 am
Location: Worcester, MA

Linking Multiple Tables togetyher in MySQL?

Post by Elmseeker »

Hi everyone,

I am currently working on designing the back end of a site for children, parents and teachers. I need to be able to link table entries with entries in other tables.

Example:
  1. Child comes to site and creates an account.
  2. An account is automagically created for the parent as well and passwords emailed.
  3. Parent logs in later and wishes to change the permission of what parts of the site their child is allowed to access.
How?! My DB entry for parents is listed as such:
ID, rname, email, u_name, u_pass, kid0, kid1, kid2, kid3, kid4, kid5, kid6, kid7, kid8, kid9, u_level
Would this be as simple as placing the ID of the childs DB entry into the kid0-kid9 places and loading the appropriate stats for each child on a click or use of drop down? If so, how would it work the other way around? I mean, how would the child be able to access their parents info?

Thank you in advance for your help.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

what if

Post by AVATAr »

what if there where 11 kids (my father haave, 6 sisters and 4 brothers!!!)
you have to split the tables:

Parents Table
ID_par, rname, email, u_name, upass, u_level

Kids Table
ID_par, kid

You link the two tables with the ID_par..
Post Reply