Re: bool type (between MySQL and PHP)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Brown wrote:
On Tue, Jan 25, 2011 at 17:05, Donovan Brooke<lists@xxxxxxx>  wrote:

What is the best PHP practice when using bools with
MySQL? Save 1's and 0's instead of true/false?

     You could either do an INT(1) DEFAULT 0 or an ENUM('Y','N') to
make it easier on yourself.


Thanks Dan,

I think the error would still persist using DEFAULT.. because as mentioned, I don't think MySQL likes:

UPDATE tablename SET vbool=

..which is not great news for me since I'd like to avoid having to redo
all my bool's in PHP (input checking, updates, add's etc.. ;-) ENUM would require that route as well I guess.

I suppose I could instead place a string value of "0" in the query statement, if bool false, perhaps?

I'll try that.

Donovan






--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux