I am storing x and y as bits in mysql database, upon fetch the record using php fetch_assoc, the display is gobbled. And I can’t find a way to test the value to see if it’s true or false… I tried using if($val), if($val==true) if($val===true), if $val is false, all 3 tests still returns true. any idea?
[x] => � [y] =>
thanks for the answer below, I now use:
function mysql_bit($bit) {
if(ord($bit) == 0 || ord($bit) == 48)return false;
return true;
}
to handle both mysql bit value and regular string/int value(from http request for example).
Does this post help?
I had this issue a looooong time ago… it is read as an ascii ‘1’ or ‘0’. I don’t think my solution at the time was exactly as nice, but I don’t have the source anymore so I will pretend it was!