Storing a boolean
Posted 03 June 2006 - 05:05 PM
Originally, I always used a tinyint field type (1 or 0).
Next I discovered Enum and, thinking it would only take 1 bit rather than 8, switched to using that. (smaller files, faster search time).
I recently read that Enum takes a minimum of 1 byte per record, so there's basically no advantage to either method.
Is there a preferred way of storing boolean values in mysql tables? What is it, and why is that method better?
Posted 03 June 2006 - 06:11 PM
Posted 03 June 2006 - 08:23 PM
There are other places too, (building under construction or fully built? weapon has bombard ability?) but I don't see how any of them are any different.
I'll have a look at the bit field.
Posted 03 June 2006 - 10:44 PM
Posted 05 June 2006 - 12:19 AM
Posted 07 June 2006 - 07:55 PM
I need to store a true/false 1/0 value in a mysql database....
There's also the CHAR(0). It stores either the NULL value or the empty string (''). You can easily check the value in PHP with something like is_string($row) or whatever.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users