Get enum values from MySQL:
If you want to display enum values from mysql then use the following query,
$query = "SHOW COLUMNS FROM table_name LIKE 'field'";
it will result,

then extract the enum values using,
$result = mysql_query($query,$link);
$row1 = mysql_fetch_array( $result , MYSQL_NUM );
$regex = "/'(.*?)'/";
preg_match_all( $regex , $row1[1], $enum_array );
$enum_fields = $enum_array[1];
Here $regex extracts the values whichever is in between single quotes enum('value1','value2','value3')
ie., it extracts only value1value2value3.
|