whoisgregg

msg:4232507 | 8:24 pm on Nov 19, 2010 (gmt 0) |
I don't do a lot with bitwise operators, but I think your query needs to look like this: <?php $sql = "SELECT * FROM dbtable WHERE '".$Mask."' & Code = '".$Mask."'"; ?> |
|
|
nelsonm

msg:4232543 | 9:45 pm on Nov 19, 2010 (gmt 0) |
thanks, While your solution won't work, you reminded me that ".$Mask. & code" must compare to something. Not "= .$Mask." but "<> '00000000000000'" for the where to work properly. So the sql statement, i think, should look like this... <?php $Mask = '10100000000000'; $sql = "SELECT * FROM dbtable WHERE '".$Mask."' & code <> '"."00000000000000"."'"; ?> |
| As long as the bitwise operation of ".$Mask. & code" do not result in all zeros, i'll get records. BTW, how did you get the php code to display in color?
|
nelsonm

msg:4232572 | 11:29 pm on Nov 19, 2010 (gmt 0) |
unfortunately, it does not work because is appears the the bitwise and/or operators only work on integers not strings like you can in php.
|
whoisgregg

msg:4234178 | 8:58 pm on Nov 23, 2010 (gmt 0) |
What happens if you take out the single quotes? MySQL should then treat those as integers. If your `Code` field is a VARCHAR (or other string) use the Cast functions [dev.mysql.com] to get it to the right type.
|
nelsonm

msg:4234238 | 11:47 pm on Nov 23, 2010 (gmt 0) |
Thanks... I give it try asap.
|
|