Search the Community
Showing results for tags 'enum'.
-
Hi everyone. I have another question, which will hopefully be the last piece to get my application going. I have a MySQL table with an enum field, with a few values (Value1, Value2, Value3, Value4). I have a HTML form that is pulling over fields from the same table, but those other fields are varchar fields. I'm wanting to create a drop down box which is dynamically populated with those enum values, and that defaults to the currently selected field. I have found a few examples of this, but they all seem to be deprecated mysql_* code, whereas I'm using mysqli_* throughout. I'm fairly new to PHP, and I have never written a function before. I figure something like this would be out there somewhere, but I haven't been able to find an example here at PHPFreaks, nor on various other forums. Here are some examples of what I have found using mysql_*: http://www.barattalo.it/2010/01/19/php-to-get-enum-set-values-from-mysql-field/ http://stackoverflow.com/questions/3715864/displaying-mysql-enum-values-in-php http://www.larryullman.com/forums/index.php?/topic/916-use-data-type-enum-for-form-drop-down-options/ http://www.pcserviceselectronics.co.uk/php-tips/enum.php I just don't know where to start with creating this function. I need to use this 3 times, or 2 different fields, which is why I assumed a function would be the best way to go. Thanks for any help!
-
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.