Afan Pasalic wrote: > Jim Lucas wrote: >> Afan Pasalic 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 >>> >> >> Try something like this. >> >> >> my table structure was >> >> CREATE TABLE `cmsws_com`.`examples` ( >> `col1` ENUM( '0', '1' ) NOT NULL , >> `col2` ENUM( 'one', 'two', 'three' ) NOT NULL >> ) ENGINE = MYISAM >> >> >> <?php >> >> # setup your db connection and stuff... >> >> $result = mysql_query("SHOW COLUMNS FROM examples"); >> if (!$result) { >> echo 'Could not run query: ' . mysql_error(); >> exit; >> } >> if (mysql_num_rows($result) > 0) { >> while ($row = mysql_fetch_assoc($result)) { >> print_r($row); >> } >> } >> >> >> My results were >> >> Array >> ( >> [Field] => col1 >> [Type] => enum('0','1') >> [Null] => NO >> [Key] => >> [Default] => >> [Extra] => >> ) >> Array >> ( >> [Field] => col2 >> [Type] => enum('one','two','three') >> [Null] => NO >> [Key] => >> [Default] => >> [Extra] => >> ) >> >> >> Hope this fits the bill >> >> > > Thanks Jim. > But, I was actually looking for column type is like ENUM, with some > differences. And it's SET type. > > -afan > I must be missing something else you haven't mentioned, AFAIK this gives you the information that you are asking for. The output shows that it is telling you Type = enum(...) Isn't that what you are asking for? If it were a set type column, then it would say Type = set(...) What are the differences that you speak of / request? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php