[thelist] boolean in MySQL

David Ulevitch davidu at everydns.net
Wed Jun 19 16:29:00 CDT 2002


<quote who="Michael Mell">
> MySQL doesn't have a boolean type, right? So what is the preferred way
> to create a column to hold a true/false value?
> I've been using
>     CHAR(1) DEFAULT "N",

I've just always used the ENUM data type:

http://www.mysql.com/doc/E/N/ENUM.html

you can set the first value to "FALSE" and the second to "TRUE" and then
simply INSERT with 0 and 1.

-davidu

> how's that?
>
> Is there some value that PHP would intrinsically recognize as true/false
> after a select, like 1 and 0?
>
> thx
> --
> mike[at]nthwave.net
> llemekim         YahooIM
> 415.455.8812     voice
> 419.735.1167     fax
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !


--
"Never doubt that a small group of thoughtful citizens can change the
world. Indeed, it is the only thing that ever has." --Margaret Mead





More information about the thelist mailing list