|Just another Perl shrine|
Check boxesby himik (Acolyte)
|on May 28, 2012 at 16:21 UTC||Need Help??|
himik has asked for the
wisdom of the Perl Monks concerning the following question:
Hello monks. I have some difficulties so i call on you.
So i have at about 100 checkboxes. And every one is different extra for a car ( ABS,ASR,ESP and the list goes on .... until 64 for now, but it will be bigger then 100 ).
So what have i done for now. Every extra abs has decimal number like abs is 1, ASR is 2, ESP is 3 .... This numbers represent the n-th bit of the number of all extras.
explanation if ABS is checked i put 1 only in the field extri on the data base if ABS, ASP are checked i put 3 on my data base. if ABS, ASP, ESP are checked i put 7 on my data base.
so 7 is 0b111? right? And this is my flags for all the extras.
if i have 3 on my field extri then i know (0b11) the first bit and the second one is up then i know that this extras are ABS ASP
Here is the problem
My field extras is big int and it is 64 bits long .... that means i have only 64 extras. so i start to look for solution and i'm thinking for bit var.
but ..... is this the best way to make that?
could you tell me some other solution that is better for the DB, because with this way my searching is so easy just put where clause with
i do not use any joins