note 54101 deleted from function.mysql-fetch-field by danbrown

From: Date: Sat, 20 Jun 2009 02:15:26 +0000
Subject: note 54101 deleted from function.mysql-fetch-field by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157159@lists.php.net to get a copy of this message
Note Submitter: cortalux at gmail dot com ---- A far easier way of getting information upon an enum field, is this. function enumget($field="",$table="") { $result=mysql_query("SHOW COLUMNS FROM $table LIKE '$field'"); if(mysql_num_rows($result)>0){ $row=mysql_fetch_row($result); $options=explode("','", preg_replace("/(enum|set)\('(.+?)'\)/","\\2", $row[1])); } else { $options=array(); } return $options; }

« previous php.notes (#157159) next »