January 10, 2016 Find all enum values in MySql using php Code Block function get_enum_values($table, $field){ $sql = "SHOW COLUMNS FROM $table WHERE Field = '$field'"; $row = mysql_fetch_array(mysql_query($sql)); $type = $row['Type']; preg_match("/^enum\(\'(.*)\'\)$/", $type, $matches); $enum = explode("','", $matches[1]); return $enum;} FacebookTwitterLinkedInPinterestWhatsAppPrintEmailMoreRedditTumblrPocketTelegramLike this:Like Loading... Related Tagged with: arrayenumFunctionMySQLphpprogrammingSQL Posted in Database, Function, MySQL, PHP, Programming by ahmadasjad Leave a comment