mysql_fetch_field.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$query = "SELECT * FROM mytable LIMIT 1";
$result = mysql_query($query);
$fields = mysql_num_fields($result);
for($count=0;$count<$fields;$count++)
{
$field = mysql_fetch_field($result,$count);
echo "<p>$field->name $field->type ($field->max_length)</p>";
}
?>
Related examples in the same category