bool type (between MySQL and PHP)

From: Date: Tue, 25 Jan 2011 22:05:26 +0000
Subject: bool type (between MySQL and PHP)
Groups: php.db 
Request: Send a blank email to php-db+get-47651@lists.php.net to get a copy of this message
Hello, I'm having some issues with bool's relating to MySQL. I am using: $tvar = true; $tvar = false; in PHP, but only the TRUE value gets accepted by the MySQL insert or update's. It appears MySQL sees the TRUE value as 1.. because that is what shows up.. and that MySQL throws an error when false because the query: UPDATE tablename SET vbool=$tbool parses to: UPDATE tablename SET vbool= which throws a syntax error. What is the best PHP practice when using bools with MySQL? Save 1's and 0's instead of true/false? TIA!, Donovan -- D Brooke

« previous php.db (#47651) next »