MySQL bit type! What better method do you have? If there are only two types of promised data in MySQL, when setting its data type, we will first think of bit, which occupies less characters, is fast, and really cool! When this data type is inserted, the value 1 changes to an icon (like a smiling face, which can be viewed on the mysql client), and the value 0 changes to a blank (probably ignored ), mySQL still knows them, so there is no problem in using SQL queries in MySQL. When it is Php, it is not known. If the data value retrieved on the page is compared with 1 or 0, the result is false!
1. The output on the page is 'R', and 0 is blank!
Test with ord () to obtain their differences,
Bit type: 1 ord (): 1 // acⅱ code of 'R'
Bit Type 0 ord (): 0
I don't know if you can do anything. It's better to know more!
Also: Why does MySQL store the bit type like this? MSSQL does not change this type!
Bit processing is troublesome. You can use it as an integer during query.
Select cast ('mybitfield' as signed) from test
This way in PHP can be compared with the integer number. From: http://www.phpchina.com/html/69/t-46369.html