Tips: obtain all possible values of the ENUM (enumeration) column in MYSQL. In fact, there is no need for other functions to support it. you only need to use some SQL statements provided by MYSQL. Here, for the sake of simplicity, take the MYSQL system table USER as an example. if you do not need any other functions, you only need to use some SQL statements provided by MYSQL.
For the sake of simplicity, take the MYSQL system table USER as an example to retrieve all possible values in the SELECT_PRIV column.
Method: show columns from table_name LIKE enum_column_name
The lower case must be changed according to your situation.
Program:
// By SonyMusic (sonymusic@163.com)
// HomePage (phpcode.yeah.net)
$ Connect_hostname = "localhost ";
$ Dbname = "mysql ";
$ Connect_username = "root ";
$ Connect_pass = "";
$ Connect_id = mysql_connect ($ connect_hostname, $ connect_username, $ connect_pass );
Mysql_select_db ($ dbname );
$ Query = "show columns from user like 'Select _ priv '";
$ Result = mysql_db_query ($ dbname, $ query );
$ Enum = mysql_result ($ result, 0, "type ");
Echo $ enum ."
";
$ Enum_arr = explode ("(", $ enum );
$ Enum = $ enum_arr [1];
$ Enum_arr = explode (")", $ enum );
$ Enum = $ enum_arr [0];
$ Enum_arr = explode (",", $ enum );
For ($ I = 0; $ I Echo $ enum_arr [$ I]."
";
}
?>
Bytes. For the sake of simplicity, take the MYSQL system table USER as an example to retrieve...