Page 1 of 1

Many-to-Many problems

Posted: Fri Dec 04, 2009 10:34 am
by MiniMonty
Hi all,

trying to set up a students / courses system and hoping someone can help
because I'm a bit out of my depth. All and any help on this much appreciated.
I took this project on for a friend when it looked simple
and it's now getting beyond my skill set as a Front end designer !

So I have a table "myMembers" which has the member basics; name, id (a number), email, password etc.
I have a table "courses" which has course_ID, course_name and course_tutor.
I think this looks like a many-to-many scenario which is something I've never tackled and after
research I'm honestly more confused than when I started :(

There are six courses that members can sign up for.
I'm confused as to where to record which member has signed up to which course
and then how to query the "join" table (members_courses) to return, for instance, which courses
any particular member has signed up for, or which list of members has signed up to any particular course.

Very grateful for any help

Best wishes
Monty

Re: Many-to-Many problems

Posted: Fri Dec 04, 2009 11:11 am
by Grizzzzzzzzzz
.. not entirely sure what you want help with, but i assume you're stuck on how to resolve the many-many relationship issue...which isn't really a PHP issue.. but whatever!

in this case i believe you'd create a link table between the two tables with two fields in it (member ID + Course ID) that become a compound key.

something similar to this

Image

http://articles.techrepublic.com.com/51 ... 34790.html