Re: how to recognize ENUM column in table?
| From: | Afan Pasalic | Date: | Thu, 06 Dec 2007 20:43:27 +0000 |
| Subject: | Re: how to recognize ENUM column in table? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265529@lists.php.net to get a copy of this message | ||
sounds like a solution!
:)
thanks andrew.
-afan
Andrew Ballard wrote:
On Dec 6, 2007 1:38 PM, Afan Pasalic <afan@afan.net> wrote:hi, I use the code from http://www.php.net/manual/en/function.mysql-fetch-field (example #1) I'm getting everything I need but can't recognize if the column is ENUM() type? e.g. column "status" is ENUM('0','1') or ENUM('live','hidden','archive') or something like that. I want to recognize this column and then create a form with radio buttons o 0 o 1 or o live o hidden o archive is it possible? thanks. -afanThe only way I've seen to do this is to first execute the query DESCRIBEmy_tableand then examine the value of theTypecolumn that is returned for the row that represents the column you are examining in your regular query. You just have to strip the 'ENUM(' and ')' from the beginning and end and then split the remaining string. Andrew