-
Notifications
You must be signed in to change notification settings - Fork 3
/
timetable.php
112 lines (93 loc) · 3.7 KB
/
timetable.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
include 'dbconnect.php';
include 'server.php';
if (isset($_SESSION['cust_name']))
{
header("location: index.php");
}
else{ //Continue to current page
header( 'Content-Type: text/html; charset=utf-8' );
}
?>
<!DOCTYPE html>
<html lang="en" class="js csstransitions">
<head>
<title>Bus Ticket Reservation System</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/normalize.css" />
<link href="assets/css/index.css" type="text/css" rel="stylesheet" />
<link href="assets/css/normalize.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="pagewrapper">
<div id="topbg"></div>
<div id="systemName">
<h1>Bus Booking</h1>
</div>
<div id="header">
<div id="mainmenu">
<header>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Register</a></li>
</ul>
</header>
</div>
</div>
<div id="content">
<div class="row" style="margin: 25px 0;">
<h1> Time Table.</h1>
<table border="0" class="busdataarea" cellpadding="0" cellspacing="20" style="width:100%; margin: 0; float:none; padding: 20px 10px;">
<thead style="text-align: left;">
<tr>
<th>From</th>
<th>To</th>
<th>Via Station</th>
<th>Departure Time</th>
<th>Arrival Time</th>
<th>Fare</th>
</tr>
</thead>
<?php
$sql = "SELECT * FROM `time_table`";
$run = mysqli_query($db,$sql);
if(!$run)
die("Unable to run query".mysqli_error($db));
$rows = mysqli_num_rows($run);
if($rows>0){
while($data = mysqli_fetch_object($run)){
echo "<td>".$data -> departure_station."</td>";
echo "<td>".$data -> arrival_station."</td>";
echo "<td>".$data -> via_station."</td>";
if(empty($data -> departure_time)){
$departure_time = "--:-- AM";
}else{
$departure_time = date('h:i A', strtotime($data -> departure_time));
}
echo "<td>".$departure_time."</td>";
if(empty($data -> arrival_time)){
$arrival_time = "--:-- PM";
}else{
$arrival_time = date('h:i A', strtotime($data -> arrival_time));
}
echo "<td>".$arrival_time."</td>";
echo "<td>".$data -> rent."</td></tr>";
}
}
else{
echo "<td colspan='5'> No data found </td><br/>";
}
?>
</table>
</div>
</div>
<!--#contentwrapper-->
<div class="clear"></div>
<div id="footer">
Copyright © OBTRS 2018.<br> All Rights Reserved.
</div>
</div>
</body>
</html>