Guest User

Untitled

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