RE: [PHP-DB] getting the options in a mysql enum

From: Date: Thu, 27 Jul 2000 07:45:00 +0000
Subject: RE: [PHP-DB] getting the options in a mysql enum
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1558@lists.php.net to get a copy of this message
Try this This will give you a list of the enum values M@ $result = mysql_query("SHOW COLUMNS FROM main LIKE 'column_name'"); while ($answer = mysql_fetch_array($result)) { ereg( "('(.*)')", $answer[1], $temp ); $array = explode( "','", $temp[2] ); while (list ($key, $val) = each ($array)) { echo "$val\n"; } } > -----Original Message----- > From: Matt Dooner [mailto:mdooner@mindspring.com] > Sent: Wednesday, July 26, 2000 04:30 > To: php-db@lists.php.net > Subject: Re: [PHP-DB] getting the options in a mysql enum > > > This query; > $description = mysql_query("DESCRIBE boat_lines type;"); > echo (mysql_result($description, 0)); > > just returns the name of the column, which in this case is type. I tried > changing 0 to 1 but there is no row 1. When I make the same query in the > mysql console, I get the correct description of the column. Any other > suggestions? > > "Chris Adams" wrote in message > <01a201bff6a2$56fcdbd0$0a65a8c0@digitaria.com>... > >> Is there any way I can get a list of the possible values in a > mysql ENUM > >> column? > > > >$description = mysql_query("DESCRIBE [Database.]Table Column"); > > > >echo mysql_result($description, 0); > > > >Note that this is the raw description, so you'll need to do a little > >parsing. > > > > > > > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > >For additional commands, e-mail: php-db-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#1558) next »