LukePVB Posted February 9, 2013 Share Posted February 9, 2013 mySQL version:5.5.24 I need help with the column type ENUM. What I want to happen is for this column to get either yes or no values. I think ENUM is used specifically for this but i dont know how to set up the column for this to work. I tried to just select ENUM as the type and leave everything else blank but when I save it gives me the error "This is not a number". I have other columns, but im almost sure the error is coming from the ENUM column. Please help. Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 9, 2013 Share Posted February 9, 2013 Well, first of all you should NOT use an ENUM type if the values are Yes/No (i.e. TRUE/FALSE). Use a Boolean (or Tiny INT) type and store a 1 or 0. If you store a string such as "Yes" or "no" then you have to add additional logic to your code to process, such as if($active=='yes') { //Do something } instead, if you use 1 or 0 you can use those values directly because they are interpreted as logical TRUE and FALSE if($active) { //Do something } But, the reason you are getting the error is probably because you have some text type field (possibly the ENUM) for which you have not supplied a length. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.