MySQL SET column

admin

Administrator
Staff member
Hey, everyone,

I've been having a bit of difficulty. I'm working on a volunteeresque web project, built on PHP. It involves a user area divided into many different groups' areas, about 16 in all. There's a small number of admin-types, some of whom are supposed to have access to some groups, some to others. A core bunch of these admin also have access to the front page of the site. I have access to everything.
What I've done is set up the database with a SET column, and each of the admin have their username, profile information, and the SET column describing the groups they have access to.

As example:
username: "JoeBob"
password: "asdfjkl8"
groups: "apple,bear,clock,main"

My difficulty comes in figuring out how to extract an individual group from the SET column. For example, if JoeBob is going to add a news item to a group's page, I want him to be able to select one of the four groups he has permission to from a dropdown box.
Another feature of the site is that the users can look at a group-specific profile page, which will have links to the profile of every admin who is a member of that group. Stuff like "SELECT * WHERE groups='clock'" doesn't seem to work.

I'm considering setting up a second database to contain the group names and id numbers, and just cross-reference them, like

ADMIN
username: JoeBob
uid: 4
groups: 1,2,3,7

GROUPS
groupname: Apple
id: 1
uid: 4,9,12

I'd like to avoid this if I can, however, as I've already created the database and have a dozen admin in the database at the moment. I don't want to go to the trouble of creating/moving/deleting all that info if I don't have to.

Thanks,
-Ian
 
Back
Top