What are the potential benefits and drawbacks of using HTML tables for displaying database query results in PHP?

Using HTML tables to display database query results in PHP can provide a structured and organized way to present data to users. It allows for easy formatting and styling of the data, making it more visually appealing. However, using tables for layout purposes can sometimes lead to accessibility issues for users with screen readers or mobile devices. It is important to consider responsive design principles and ensure that the table is accessible to all users.

<?php
// Assume $results is an array of database query results

echo "<table>";
echo "<tr><th>ID</th><th>Name</th><th>Email</th></tr>";
foreach ($results as $row) {
    echo "<tr>";
    echo "<td>" . $row['id'] . "</td>";
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['email'] . "</td>";
    echo "</tr>";
}
echo "</table>";
?>