Re: Enum MySQL datatype [message #29 is a reply to message #27] |
Thu, 11 May 2006 04:55 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Your use of the enum datatype is non-standard. You can define a list of values for 'state' as in:
ENUM('working','retired','ill','resigned') which is equivalent to array(0 => 'working', 1 => 'retired', 2 => 'ill', 3 => 'resigned'). The text values are displayed on the screen in a dropdown list (or even a radio group) but it is the numeric values which are actually stored in the database.
I you try to define a list of values for 'action' as in:
ENUM('active','inactive','inactive','inactive') this would be ridiculous as you have repeating values, so does the value 'inactive' equate to the number 1, 2 or 3?
Trying to store both the 'state' and 'action' in a single field is quite wrong IMHO. 'State' is what you should be displaying to the user, but the correlation between 'state' and 'action' should be done separately.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|