Re: How do I fetch an array of all field names in a mysql database?



Thanks for the lead-the manual is so huge and tough to read that I gave
up the first time, but now I think I've got it:

$query="SELECT * FROM my_table";
$result=mysql_query($query);
$i = 0;
while ($i < mysql_num_fields($result)) {
$meta = mysql_fetch_field($result, $i);
echo $meta->name."</br>\n";
$i++;
}

Is that good, non-depracated code though?

.