Re: how to recognize ENUM column in table?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sounds like a solution!
:)

thanks andrew.

-afan




Andrew Ballard wrote:
On Dec 6, 2007 1:38 PM, Afan Pasalic <afan@xxxxxxxx> 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.

-afan

The only way I've seen to do this is to first execute the query
DESCRIBE `my_table` and then examine the value of the `Type` column
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux