Skip to content

Instantly share code, notes, and snippets.

@mrroot5
Created April 28, 2015 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrroot5/9d19ab2851c44bdb28a0 to your computer and use it in GitHub Desktop.
Save mrroot5/9d19ab2851c44bdb28a0 to your computer and use it in GitHub Desktop.
function get_enum_values( $table, $field )
{
$type = $this->db->query( "SHOW COLUMNS FROM {$table} WHERE Field = '{$field}'" )->row( 0 )->Type;
preg_match("/^enum\(\'(.*)\'\)$/", $type, $matches);
$enum = explode("','", $matches[1]);
return $enum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment