McGrotty, Charles writes:

> I have been bashing my head for a couple of hours now trying to
> create an enum field which will hold a true or false (1 or 0)
> value, but I always get an error when I try to create the enum
> field.

An ENUM can only hold strings, so you're probably missing
the quotes around 0 and 1. Note that an ENUM has a special
value, the empty string, which has a numerical value of 0.
Your strings ('0' and '1') will have numerical values of
1 and 2, so you wont be able to use logical operators on
the fields directly. E.g., instead of "WHERE !field" you'll
have to write "WHERE field == '1'". Because of this, I've
ended up using TINYINT(1) instead, but if you're really
concerned about space requirements, you should consider using
a CHAR(0) _without_ NOT NULL. Now that's an odd way of storing
booleans.

//C

-- 
 Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
 [EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/
 Amiga user since '89, and damned proud of it too.


And here's for the bloody stupid piece of crap filter: sql

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to