What are the common pitfalls when trying to display PHP results in an HTML table?

One common pitfall when trying to display PHP results in an HTML table is not properly formatting the table structure or not iterating through the PHP results correctly. To solve this issue, make sure to use proper HTML table tags and loop through the PHP results array to generate the table rows dynamically.

<table>
    <tr>
        <th>ID</th>
        <th>Name</th>
        <th>Email</th>
    </tr>
    <?php
    // Assuming $results is an array of data to display
    foreach ($results as $result) {
        echo "<tr>";
        echo "<td>".$result['id']."</td>";
        echo "<td>".$result['name']."</td>";
        echo "<td>".$result['email']."</td>";
        echo "</tr>";
    }
    ?>
</table>