M. Qew M. Qew - 1 year ago 83
MySQL Question

Registering people to a specific event

I'm sorry because i'm pretty sure this was asked like a hundred times before, but my problem is, i dont even know what to search for exactly.

I created a site for our organisation were admins can create events and the users are able to join them.

I already wrote the login, the overview of the events and the form to create users and new events.

I have 2 SQL tables atm

'users' (ID, name, pw, etc.)


'events' (id, name, adress, etc.)

Now i want ppl to be able to register to these events, but since im quite new when it comes to PHP / SQL i dont know exactly how to realize that.
I heard something about many to many relationships and foreign keys but im not quite sure if that is what i need.

Thanks in advance for every tip and just call if the infos i gave are not enough.

greetz Moe

Answer Source

Hey I think it's a pretty simple foreign key. The conventional way is to have a table to map them together.

users (id, name,...) - all the different unique users
events (id, title,....) - all the different unique types of events
users_events (fk[users.id], fk[events.id]) - map users to events

Let me know if you need any more help!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download