How can the issue of displaying only one record in the first row be resolved in PHP?

Issue: The problem of displaying only one record in the first row can be resolved by using a loop to iterate through each record and display them in separate rows in the HTML table.

<?php
// Assuming $records is an array of records fetched from a database

echo "<table>";
foreach ($records as $record) {
    echo "<tr>";
    echo "<td>" . $record['column1'] . "</td>";
    echo "<td>" . $record['column2'] . "</td>";
    // Add more columns as needed
    echo "</tr>";
}
echo "</table>";
?>