On Thu, Dec 11, 2008 at 2:32 PM, tedd <tedd.sperl...@gmail.com> wrote: > At 1:55 PM -0500 12/11/08, Robert Cummings wrote: >> >> Student attendance should be a table with rows for each student in >> attendance. If you want to limit the number make a check before adding >> another student. Don't hard code the number via fields like above or >> you'll find it overly ugly to add/remove students or even increase the >> number of allowed students. As it stands to allow 6 students you would >> have to add 2 more columns. With attendance controled by a table with a >> row for ewach attendance you would only need to update a configuration >> variable the determines the maximim number of allowed students in >> attendance. >> >> Cheers, >> Rob. > > Rob: > > I see -- the solution is a table for courses, students, instructors and > enrollment. > > The enrollment table will hold links to all (third normal). > > If I want to limit the number of students in a course, then just count the > number of students enrolled in a specific course within the enrollment table > and check that number against the maximum allowed before adding another > enrollment record. > > Also, if a student cancels, then it's only a deletion of an enrollment > record and all is right with the world. > > That's good. > > Sometimes it's good to talk things like this through -- clears the fuzzy > thinking. > > Thanks, > > tedd >
That's the way to go. Just keep in mind that you will have to consider ways of preventing overloading your courses due to concurrency, whether you use table locks or devise your own mechanism. I don't know if you are allowing students to self-enroll or not. You just don't want two users to both see that a course has one opening left and both try to take that spot at the same time. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php