# What is the best way of storing users and events in a DB?

**URL:** <https://forum.kirupa.com/t/what-is-the-best-way-of-storing-users-and-events-in-a-db/229072>\
**Category:** programming\
**Created:** [June 13, 2007, 8:51pm UTC](https://forum.kirupa.com/t/what-is-the-best-way-of-storing-users-and-events-in-a-db/229072 "2007-06-13T20:51:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eikern](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Eikern](https://forum.kirupa.com/u/Eikern)\
**Post date:** [June 13, 2007, 8:51pm UTC](https://forum.kirupa.com/t/what-is-the-best-way-of-storing-users-and-events-in-a-db/229072/1 "2007-06-13T20:51:07Z")

</div>

Hi!

I’m creating a website using PHP and MySQL which is going to enable me to create events, and then link users I register to them. I want to be able to have one person registered to multiple events.

Currently I’ve thought about two ways of doing this.

[LIST=1][_]Having the party-table contain a field with the participants listed like this: “1,3,6,9,14,23…” with the userids of all the people, and then getting all of the users in a second query or something.  
[_]Having a field on each participant like above, but with the partyid instead. And then just filtering those with the party-id out.  
[/LIST]

As of this moment, I like the second one the best (obviously), but is there a better method of achieving this? I don’t really like to store the values separated with commas. I guess I can store PHP-arrays, but isn’t there a SQL-function or something maybe I can use?

Does anyone have any suggestions or tips on how something like this can be done? 🙂

Appreciate it.

-Eikern
