note 54101 added to function.mysql-fetch-field
| From: | cortalux at gmail dot com | Date: | Thu, 23 Jun 2005 17:09:16 +0000 |
| Subject: | note 54101 added to function.mysql-fetch-field | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90850@lists.php.net to get a copy of this message | ||
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;
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-field.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54101
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54101&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54101&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54101&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54101&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54101&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54101&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54101&report=yes
Search -- http://master.php.net/manage/user-notes.php