<style> table { width: 50%; border-collapse: collapse; } th, td { border: 1px solid black; padding: 8px; text-align: left; } th { background-color: #f2f2f2; } </style> <?php echo "Rujira Thongklung 65160015"; //<?php $servername = "db"; $username = "demo"; $password = "Noon+020347"; //Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($result->num_rows > 0) { echo "<table border='1' cellspacing='0' cellpadding='10'>"; echo "<tr><th>ID</th><th>First Name</th><th>Last Name</th></tr>"; while($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td>" . $row["id"] . "</td>"; echo "<td>" . $row["fname"] . "</td>"; echo "<td>" . $row["lname"] . "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close(); ?>