I\'m using a bit(1) field to store boolean values and writing into the table using PDO prepared statements.
This is the test table:
CREATE TABLE IF N
Because prepare adds ' to your parameter, You have only to add b before parameter name
prepare
'
b
$statement = $pdo->prepare('INSERT INTO `test` (SomeText,TestBool) VALUES (?, b?)'); $statement->execute(array("TEST", 1 /* or TRUE */));
Note: you can use 1, 0 or TRUE, FALSE.
1, 0
TRUE, FALSE