-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow_bus_schedule.php
More file actions
52 lines (47 loc) · 2.07 KB
/
Copy pathshow_bus_schedule.php
File metadata and controls
52 lines (47 loc) · 2.07 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!DOCTYPE html>
<html>
<head>
<title>Show Bus Schedule</title>
</head>
<body>
<h2 class="text-center">Vehicle Schedule</h2>
</body>
<?php
// Connect to the database
$conn = mysqli_connect("localhost","root","","bus");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Fetch data from the "vehicle_schedule" and "location" tables
$result = mysqli_query($conn, "SELECT vs.scheduleID, vs.departureTime, loc.pickUpLocation,loc.dropOffLocation,
v.vehicleNO,v.vehicleType
FROM vehicle_schedule vs
LEFT JOIN location loc
ON vs.locID = loc.locID
LEFT JOIN vehicle v
ON vs.vehicleID = v.vehicleID");
echo "<table class='table table-bordered table-hover'>
<thead class='thead-dark'>
<tr>
<th>Departure Time</th>
<th>Starting Location</th>
<th>Ending Location</th>
<th>Vehicle Number</th>
<th>Vehicle Type</th>
</tr>
</thead>
<tbody>";
while($row = mysqli_fetch_assoc($result)) {
echo "<tr>
<td>".$row["departureTime"]."</td>
<td>".$row["pickUpLocation"]."</td>
<td>".$row["dropOffLocation"]."</td>
<td>".$row["vehicleNO"]."</td>
<td>".$row["vehicleType"]."</td>
</tr>";
}
echo "</tbody></table>";
mysqli_close($conn);
?>