Código :
<?php $conex= mysql_connect("HOST","USER","PASSWORD"); mysql_select_db("DATABASE"); function extractValues ($table, $column){ $sql = "SHOW COLUMNS FROM $table LIKE '$column'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); preg_match_all("/(?:(?!:[\(\,])')(.+?)(?:'(?:[\)\,]))/",$row[1],$enums); return ($enums[1]); } echo "<pre>"; print_r(extractValues("TABLE","FIELD")); echo "</pre>"; ?>
salida:
Código :
Array ( [0] => Opcion 1 [1] => Opcion 2 [2] => Opcion 3 )