#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0

    How to prevent a table row from displaying based on number of registrants in another


    I am a VERY new newbie to PHP, so any help would be greatly appreciated!

    I have one table that is prepopulated with data for different classes available and a second table that is connected to a form for people to register for those classes.

    I want to be able to prevent a row from the classes table from displaying once the number of people that have registered has reached the max capacity.

    The other tricky part is each class will have different max levels. For example, class 1 could max out at 15 participants, but class 2 could max out at 5.

    Any help with examples would be GREATLY appreciated!!!

    Thanks,
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    this is a MySQL question.

    Store the maximum capacity in the classes table. And then use a query that counts the participants and rejects the classes which have reached the maximum (with a HAVING clause).
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo