I am trying to display field names from a MySQL query using PHP. I'm not getting anything to display when I print the field name into an HTML table and I'm not sure if this is how I should be going about getting the field names. Here is my code:
$i = 0;
while( $i < mysqli_num_fields($result)){
$field_names = mysqli_fetch_fields($result);
echo "<th>$field_names->name</th>";
$i++;}