-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysql.php
28 lines (24 loc) · 869 Bytes
/
mysql.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
include 'dbconfig.php';
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Retrieve data from the database
$sql = "SELECT course_code, course_name, date_enrolled, finish_date, status FROM stdEnrolled";
$result = $conn->query($sql);
// Display data in table rows
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td class='border px-4 py-2'>" . $row["course_code"] . "</td>";
echo "<td class='border px-4 py-2'>" . $row["course_name"] . "</td>";
echo "<td class='border px-4 py-2'>" . $row["date_enrolled"] . "</td>";
echo "<td class='border px-4 py-2'>" . $row["finish_date"] . "</td>";
echo "<td class='border px-4 py-2'>" . $row["status"] . "</td>";
echo "</tr>";
}
} else {
echo "0 results";
}
$conn->close();
?>