Take the 2-minute tour ×

I'm developing a participant-event registration web app in php and have come across the following problem:

We have multiple events for our tech-fest in college and have around 4000 participants. At the registration desk, the participants have to be signed up for the events(single/multiple). At one point, the admin must be able to LOCK the event so that participants can no longer register for that event(meaning the event has already started). Then, the admin needs to be able to print out a list of all the people who have signed up for each event(after LOCKing).

We came up with this:

  • have a BOOLEAN column for each event in the 'participant' table
  • have a multiple select field as the interface for event input
  • implode() the received array
  • explode() the result
  • set foreach explod()ed event, set BOOLEAN as 1 against the participant

so when the admin wants a print, get all participants where BOOLEAN for event-name is set to 1

This looks like a little ugly, and we're hoping someone has a better idea to work around this. Thank you.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Sounds like you could use some normalization. "boolean column for each event". So if you've got 50 events, you've got 50 columns? It would make far more sense to have an events table, a users table, and an "events_users" table to link the two, e.g:

create table events_users (
    user_id int,
    event_id int,
    primary key (user_id, event_id),
    foreign key (user_id) references users (id),
    foreign key (event_id) references events (id)

The 'lock' field goes into the events table. Then getting the participants is as easy as:

select user_id
from events_users
where event_id = XXX
share|improve this answer
thanks a bunch, Marc! :) –  Niaz Mohammed Nov 17 '12 at 8:33
i didn't think at first that it could support multiple event registration, but now i get it- insert a ($user_id, $event_id) pair for each event, right? i really appreciate how fast you replied; albeit it took me a day to understand the concept involved. cheers. –  Niaz Mohammed Nov 17 '12 at 8:40

Your Answer


