Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit ceab3b9d authored by 65160027's avatar 65160027
Browse files

Add index.php

parent 87c6d130
No related branches found
No related tags found
No related merge requests found
<?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>";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment