note 8880 added to mysql_fetch_field
| From: | dave at techweavers dot net | Date: | Wed, 04 Oct 2000 05:48:09 +0000 |
| Subject: | note 8880 added to mysql_fetch_field | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5997@lists.php.net to get a copy of this message | ||
If you want to get the max length of a column not just the data use this:
$result = mysql_query ("SELECT * FROM table");
$fields = mysql_num_fields ($result);
$i = 0;
while ($i < $fields) {
$len = mysql_field_len ($result, $i);
$i++;
}
Or refer to http://www.php.net/manual/function.mysql-field-type.php
http://www.php.net/manual/function.mysql-fetch-field.php