1 | initial version |
When inserting a value of 0 into a bit(1) field in MySQL using PDOstatement, the value is actually being converted to a boolean value. In MySQL, the boolean value false is represented by 0 and the boolean value true is represented by 1.
Therefore, when you insert a value of 0 into a bit(1) field, MySQL interprets this as false and stores it as 0 in the table. However, when you fetch the data from the table, MySQL returns it as a boolean value, where false is represented by 0 and true is represented by 1.
So, even though you inserted a value of 0 into the bit(1) field, MySQL is actually storing it as false (0), but returning it to you as true (1) when you fetch the data.