From ceab3b9d89c922de8c80a5f897a8c9da6c987abb Mon Sep 17 00:00:00 2001 From: 65160027 <65160027@go.buu.ac.th> Date: Tue, 18 Mar 2025 18:18:58 +0700 Subject: [PATCH] Add index.php --- index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 0180df6..7fc1702 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ <?php $servername = "db"; $username = "demo"; -$password = "12456"; +$password = "123456"; $dbname = "demo"; $conn = new mysqli($servername, $username, $password, $dbname); @@ -11,7 +11,7 @@ if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } -$sql = "SELECT id, fname, lname FROM student"; +$sql = "SELECT id, fname, lname, score FROM student"; $result = $conn->query($sql); if ($result->num_rows > 0) { @@ -40,11 +40,12 @@ if ($result->num_rows > 0) { } </style>"; - echo "<table> + echo "<table id='studentTable'> <tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> + <th>Score</th> </tr>"; while($row = $result->fetch_assoc()) { @@ -52,6 +53,7 @@ if ($result->num_rows > 0) { <td>" . htmlspecialchars($row["id"]) . "</td> <td>" . htmlspecialchars($row["fname"]) . "</td> <td>" . htmlspecialchars($row["lname"]) . "</td> + <td>" . htmlspecialchars($row["score"]) . "</td> </tr>"; } -- GitLab