How can one retrieve the names of individual columns in a MySQL query result using PHP?

To retrieve the names of individual columns in a MySQL query result using PHP, you can use the `mysqli_fetch_field_direct` function along with a loop to iterate through each column. This function returns information about a field in a result set, including the name of the column. You can then access the column names by using the `name` property of the field object.

// Assuming $result is the MySQL query result
while ($field = mysqli_fetch_field_direct($result)) {
    echo $field->name . "<br>";
}