mysql_fetch_field
mysql_fetch_field(result_id[, field_position])
This function returns an object that contains information about a particular
column in the supplied result set (result_id). If the field_position (the
first column is position 0) is not specified, then repeated calls to mysql_fetch_field will
retrieve each of the columns one at a time, from left to right. Assuming the
result of this function is stored in $field, then the properties
of the retrieved field are accessible as shown in "Object fields for mysql_fetch_field".
| Object property | Information contained |
|---|---|
| $field->name | Column name |
| $field->table | Name of table the column belongs to |
| $field->max_length | Maximum length of the column |
| $field->not_null | 1 if the column is set NOT NULL |
| $field->primary_key | 1 if the column is set PRIMARY KEY |
| $field->unique_key | 1 if the column is set UNIQUE |
| $field->multiple_key | 1 if the column is a non-unique key |
| $field->numeric | 1 if the column is numeric |
| $field->blob | 1 if the column is a BLOB |
| $field->type | The data type of the column |
| $field->unsigned | 1 if the column is UNSIGNED |
| $field->zerofill | 1 if the column is set ZEROFILL |