Mathematical Query
Posted: Thu Oct 30, 2003 11:16 am
I have a database (MySQL) created with a table called "registrations" which records the registration information of users. I am only allowing a certain amount of users to register per "course". Right now, I'm displaying a table of all registrations. A user can click on a registration button (next to each registration) and sign up for it.
However, I want the registration button to show a different button (which reads BOOKED) when the registered course is full. The amount determining the "full" course is found in a table called "schedules."
So, here is a summary of tables and definitions:
registrations = table of records of registrations
schedules = table of records of courses
amount = field with registration limit (number) inside the "schedules" table
The list will show all schedules with REGISTER or BOOKED buttons. The BOOKED buttons are inactive (no link). The REGISTER are linked (already done).
So, a query will check the number of records (in the "registrations" table) of a specific "course" and see if it is greater or less than the "amount" set in the "course.amount" field.
If is 'less than', display REGISTER button. If 'equal to' or 'more than' display BOOKED button.
Understood? Hard to explain. But anything will help. I just need to know where to begin.
Right now I have the list displayed of all "courses" with all having the ability to REGISTER no matter what.
However, I want the registration button to show a different button (which reads BOOKED) when the registered course is full. The amount determining the "full" course is found in a table called "schedules."
So, here is a summary of tables and definitions:
registrations = table of records of registrations
schedules = table of records of courses
amount = field with registration limit (number) inside the "schedules" table
The list will show all schedules with REGISTER or BOOKED buttons. The BOOKED buttons are inactive (no link). The REGISTER are linked (already done).
So, a query will check the number of records (in the "registrations" table) of a specific "course" and see if it is greater or less than the "amount" set in the "course.amount" field.
If is 'less than', display REGISTER button. If 'equal to' or 'more than' display BOOKED button.
Understood? Hard to explain. But anything will help. I just need to know where to begin.
Right now I have the list displayed of all "courses" with all having the ability to REGISTER no matter what.