Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Enum MySQL datatype
Re: Enum MySQL datatype [message #29 is a reply to message #27] Thu, 11 May 2006 04:55 Go to previous messageGo to previous message
AJM is currently offline  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.


 
Read Message
Read Message
Read Message
Read Message
Next Topic: //DebugBreak();
Goto Forum:
  


Current Time: Thu Nov 28 08:56:49 EST 2024

Total time taken to generate the page: 0.00889 seconds