html - Php Fetch Results into the table
one text
Solution:
You have to move the closing </table>
outside the loop.
$Sql = "SELECT Registration_Number,Name FROM vta";
$Result = $conn->Query($Sql);
if($Result->num_rows > 0) {
echo "<table border=2>
<tr><th>Registration_Number</th>
<th>Name</th></tr>";
while ($Row = $Result->fetch_assoc()){
echo "<tr><td>$Row['Registration_Number']</td><td>$Row['Name']</td></tr>";
}
echo '</table>';
}
$conn->Close();
Source