PHP function to return MySql Enumeration values as an Array

by Sowndarya 2013-12-31 10:49:30

function getEnums($table,$field)
{
$sql = "SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'";

$this->query($sql);

preg_match_all('/'(.[^']+)'/',$this->get('COLUMN_TYPE'),$matches);

return $matches[1];
}


538
like
0
dislike
0
mail
flag

You must LOGIN to add comments