anser316 Posted April 10, 2008 Share Posted April 10, 2008 Hi. This is a column and its constraints which i have added in a table on mysql exemption_type ENUM('NO','YES') NOT NULL, The default value is 'NO' which i intend it to be. I insert the exemption_type on a php form, and it shows that it is inserted. On a linked php form i have: if ($row[exemption_type]=Yes){ some code } else if($row[exemption_type]=No){ some code } else echo "Error"; For some reason it always executes the first if statement, whether its Yes or No. I would appreciate some help, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/100491-solved-enum-and-ifs/ Share on other sites More sharing options...
digitalgod Posted April 10, 2008 Share Posted April 10, 2008 that's because you're using the assignment operator, you should use "==" without the quotes, you should also add quotes to Yes and No so your code should look like this if ($row[exemption_type]=='Yes'){ some code } else if($row[exemption_type]=='No'){ some code } else echo "Error"; Quote Link to comment https://forums.phpfreaks.com/topic/100491-solved-enum-and-ifs/#findComment-513915 Share on other sites More sharing options...
anser316 Posted April 10, 2008 Author Share Posted April 10, 2008 thanks that worked, i also had to change it to from Yes to YES, so i guess enum is case sensitive Quote Link to comment https://forums.phpfreaks.com/topic/100491-solved-enum-and-ifs/#findComment-513954 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.