What are the best practices for handling multiple results in a SELECT query and displaying them in a tabular format in PHP?

When handling multiple results in a SELECT query in PHP, it is best practice to fetch the results using a loop and display them in a tabular format using HTML. This can be achieved by looping through the results array and echoing out the data within HTML table tags.

<?php
// Assuming $results is an array of results fetched from a SELECT query

echo "<table>";
echo "<tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>";

foreach ($results as $row) {
    echo "<tr>";
    echo "<td>" . $row['column1'] . "</td>";
    echo "<td>" . $row['column2'] . "</td>";
    echo "<td>" . $row['column3'] . "</td>";
    echo "</tr>";
}

echo "</table>";
?>