What is the recommended approach to output database results in multiple columns using PHP?

When outputting database results in multiple columns using PHP, the recommended approach is to fetch the data from the database and then loop through the results while organizing them into columns. This can be achieved by using HTML table elements to structure the output in a visually appealing way.

<?php
// Assuming $results is an array of database results

echo '<table>';
echo '<tr>';
$counter = 0;
foreach ($results as $result) {
    if ($counter % 3 == 0 && $counter != 0) {
        echo '</tr><tr>';
    }
    echo '<td>' . $result['column_name'] . '</td>';
    $counter++;
}
echo '</tr>';
echo '</table>';
?>