- Aug 26, 2001
- 13,941
- 1
- 0
So, I've been using patUser (if anybody is familiar with it) to make a secure login system for my website. In customizing it to suit my needs, I ran across an interesting problem. Basically, each of my users can belong to up to five teams and I want a way to easily store this information.
What I'm thinking about doing now is creating a teams table which will have a team ID (tid) and name field.
teams
tid name
1 1999-2000 team a
2 1999-2000 team b
3 2000-2001 team a
etc....
then i was going to create another table called userteams or something which would look like this:
userteams
id tid uid (for userid)
1 12 1
2 13 1
3 14 1
4 15 1
that way when i wanted to query all the members of team 12 i could just return all instances of the tid in the userteams field and look up the corresponding uid.
Does this make sense or will the userteams get too long too quickly?
What I'm thinking about doing now is creating a teams table which will have a team ID (tid) and name field.
teams
tid name
1 1999-2000 team a
2 1999-2000 team b
3 2000-2001 team a
etc....
then i was going to create another table called userteams or something which would look like this:
userteams
id tid uid (for userid)
1 12 1
2 13 1
3 14 1
4 15 1
that way when i wanted to query all the members of team 12 i could just return all instances of the tid in the userteams field and look up the corresponding uid.
Does this make sense or will the userteams get too long too quickly?