Linked Questions
10 questions linked to/from PDOstatement (MySQL): inserting value 0 into a bit(1) field results in 1 written in table
1 vote
1 answer
127 views
PDO issue with bit fields [duplicate]
Trying to execute insert in table with bit fields, but as result all fields are filled as 1 by default. Do not understand where my mistake or this is some specific in PDO. Example of preapred query: ...
1429 votes
13 answers
1.1m views
Which MySQL data type to use for storing boolean values
Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP ...
2 votes
6 answers
5k views
Laravel 5.8 BIT(1) datatype issue
I have a column enabled with datatype bit(1). I am trying to save 0 or 1 value in Database by Laravel eloquent. $model->enabled = $inputs['enabled']; $model->save(); I have saved values in my ...
7 votes
1 answer
4k views
Insert BIT value in MySQL using PDO Prepared Statement
How do I insert a BIT value in MySQL using a PDO Prepared Statement? Below is what I tried and my results. <?php function testIt($value) { $sql='INSERT INTO test(id,data) VALUES(?,?)'; $...
3 votes
2 answers
3k views
PHP PDO bindParam() and MySQL BIT
I'm trying to update data in a table with a BIT type value in it, like the following : // $show_contact is either '1' or '0' $query->bindValue(':scontact', $show_contact, PDO::PARAM_INT); The ...
1 vote
2 answers
982 views
How do you use PDO prepared statements with a BIT(1) column?
I have a database table with a few BIT(1) type columns. If I were to forget about prepared statements, I could easily do something like this: UPDATE tablename SET bit_column_1 = b'1', bit_column_2 = ...
4 votes
2 answers
907 views
PDO prepared statements with bit fields
I experience an issue when working with PDO prepared statements and bit data types When retrieving the result from the DB with PDO prepared statement an empty result set is returnd, but the correct ...
1 vote
0 answers
1k views
BIT columns all “1” after a phpMyAdmin export/import
I have to import data from a MySQL database using phpMyAdmin. I have exported my database from my local machine using phpMyAdmin. After that I imported the script file to my host. All of data in the ...
2 votes
2 answers
427 views
Treating MySQL's BIT datatype on different OS
I had no problems working with MySQL's BIT data type on a Windows environment with PHP and PDO. The only trick that I used was to cast it to int. But when I uploaded the code to a Linux server, then ...
0 votes
0 answers
236 views
PDO MySql has hard time inserting bit values
I cannot insert 1 or 0 into my bit column. $executes=[1]; $prepare=$connection->prepare('insert into TABLE(BITVALUE) values(?)'); $prepare->execute($executes); Will spit out an error of: ...