Here is some code expanding on the comment by krang. It parses the allowed values out of an enum type, and puts these in an array. Useful for generating select boxes for search pages and the like - the behaviour is slightly different than doing "SELECT DISTINCT" as this method will provide all the possibilities, not merely what happens to be in the table at the time.
$result = mysql_query("SHOW FIELDS FROM database_name.table_name LIKE 'enum_column_name'");
$row = mysql_fetch_array($result);
if(preg_match("/^enum\((.*)\)$/", $row['Type'], $matches)) {
$values = split(",", preg_replace("/'/", "", $matches[1]));
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-field-type.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33571
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33571&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33571&report=yes
Note Submitter: e@no-spam
----
Here is some code expanding on the comment by krang. It parses the allowed values out of an enum type, and puts these in an array. Useful for generating select boxes for search pages and the like - the behaviour is slightly different than doing "SELECT DISTINCT" as this method will provide all the possibilities, not merely what happens to be in the table at the time.
$result = mysql_query("SHOW FIELDS FROM database_name.table_name LIKE 'enum_column_name'");
$row = mysql_fetch_array($result);
if(preg_match("/^enum\((.*)\)$/", $row['Type'], $matches)) {
$values = split(",", preg_replace("/'/", "", $matches[1]));
}