On my home computer
mysql_fetch_row( mysql_query(" select b'1' ") )[0]
returns the string "1".
But when placed on a web server, a string with the ASCII character 1 is returned.
Doc says -
Bit values ββare returned as binary values. To display them in printable form, add 0 or use a conversion function such as BIN ().
But on my local machine, it still returns β1β without any conversion made by me.
How can I have the same behavior on my web server?
If I get the same behavior, I don't need to convert my PHP codes with
$row = mysql_fetch_row( mysql_query(" select bit1_field from .. where .. ") ); if( $row[0] === '1' ) ...;
to
... select bit1_field+0 as bit1_field ...
where bit1_field is of type bit(1) .
php mysql
gom
source share