tibberous Posted February 11, 2013 Share Posted February 11, 2013 I have a MySQL set. I could query it as a string and do string compare, but I'd kind of rather get it as an i and do bit comparision. So... how do I do that? I know: select `permissions`+0 Will give me the decimal value of the set. How can I check to see if a bit is on or off though? Quote Link to comment https://forums.phpfreaks.com/topic/274325-bit-compare-on-a-set/ Share on other sites More sharing options...
Christian F. Posted February 11, 2013 Share Posted February 11, 2013 Haven't tried this, but it should work: SELECT `permissions` & $Bit Where $Bit is the bit value you want to test for. Quote Link to comment https://forums.phpfreaks.com/topic/274325-bit-compare-on-a-set/#findComment-1411699 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.