Guest User

Untitled

a guest
May 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function get_enum_options($table, $column){
  2. $query = sprintf('SHOW COLUMNS FROM %s LIKE "%s"', $table, $column);
  3. $result = db_query($query);
  4.  
  5. if( mysql_num_rows($result) > 0 ){
  6. $result = db_fetch_assoc($result);
  7. $result = str_replace(array('enum(', ')', '\''), '', $result['Type']);
  8. $result = explode(',', $result);
  9. } else{
  10. $result = false;
  11. }
  12.  
  13. return $result;
  14. }
Add Comment
Please, Sign In to add comment