uebermann Posted April 10, 2008 Share Posted April 10, 2008 Hi all, PHP script I'm running resides on a Fedora 6 linux box with PHP Version 5.1.6 Is there a way to have a PHP script pull over boolean values (1 or 0 ) from a boolean (tinyint(1)) column from a Mysql database. Basically I have a database in the field that is used to collect data, then the PHP script pulls the data off the remote database and inserts it into my database here at the office. The problem with this, though, is that it sees the boolean columns in the database as "true" and "false" instead of 1s and 0s. So when it goes to insert the data into the database here, the PHP script tries to insert "true" or "false" into a column that only accepts 1s or 0s and is stripping the data off completely (since obviously true and false are not 1 nor 0). So is there a way to keep these as 1s or 0s when transferring across or am I just going to have to change the database here int he office to accept string values of true or false on these columns instead? Thanks Link to comment https://forums.phpfreaks.com/topic/100553-problems-with-tinyint1-boolean-in-mysqlphp-scripts/ Share on other sites More sharing options...
awpti Posted April 11, 2008 Share Posted April 11, 2008 Typecast or just check the TRUE/FALSE value and set it to 1/0 respectively. Link to comment https://forums.phpfreaks.com/topic/100553-problems-with-tinyint1-boolean-in-mysqlphp-scripts/#findComment-514416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.