The printout of data is always interpreted as character data when displayed in a browser. If you want to get an accurate representation of the HEX or BIN data, you will need to convert it either when selecting data using: HEX ()
SELECT HEX(mydata) as hexdata FROM mytable ...
And when you output it, there will now be a string of HEX characters. I think there is an equivalent for binary format that outputs 0 and 1, but I'm not sure ...
If you cannot convert data at the mysql level (there may be many reasons), you can use the bin2hex equivalent:
echo bin2hex($mydata['mybinarydata'];
Documents for bin2hex can be found at: http://www.php.net/bin2hex
Good luck.
source share