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? 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. 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
Archived
This topic is now archived and is closed to further replies.