You're very close.
One table should list the maximum event sizes like this:
Max Event Sizes:
Event #1: 50
Event #2: 300
Event #3: 250
so if you said: select max_size from max_event_size where id=2
you would get a result of "300" meaning that there were 300 people allowed to sign up for this event
Then you have another table that lists what registrations have been recorded so far like this:
registration table:
John Smith, 1 Main Street, 555-1212, Event 7
Andy Ross, 2 Maple Street, 555-2345, Event 3
Jane Hoben, 3 Arbor Lane, 555-6666, Event 3
so if you say: select name from registrations where event=3
then you will get TWO results
so when you say: $number = mysql_numrows($result);
Then $number will be 2 (because two people have signed up for event #3 in my example)
So your if statement checks to see if $number is less than the max_event_size you got from the 1st query
if ($number < $max_event_size) { display "Add Attendee" button }