| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in Jul 2003
Lives in Research Triangle Park, NC / Blacksburg, VA
57 posts
Gave thanks: 0
Thanked 0 times
|
In my database of users they have 6 privledges that I can either set or unset. That leaves 2^6 combinations so I don't really want to establish a "level" system since there isn't any logical hierarchy of user privledges -- pretty ad hoc.
My convention in a situation like this would be to whip out my old C trick of using a hexadecimal number with 6 of the bits (ranging from 0x01 to 0x37) and storing that with a binary &, then pulling the fields out with a binary |. Is there a better way to do this while storing these values in the MySQL database? Having 6 enums in the database seems a bit inefficient, but it might have some advantages with using SELECTS against certain privledges. Just wondering what some experienced MySQL people thought.
__________________
"I tried to go to Target but I missed" ~Mitch |
|
|
|
|
#2 (permalink) |
|
the one who was
Super #1
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
|
Im not really experienced in mySql, but I think that ENUMs are just a fancy string object. All you would really be doing is storing 6 more string fields in the database. Shouldn't hurt size much at all, and if you use some form of session tracking, you would only need to make that query for the user only one time for each session. Besides, I think the scripting that you do to manipulate the data will take more resources than doing the query..
Just my 1.5 cents worth.
__________________
Patrick Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org |
|
|