-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplaytrain.php
More file actions
64 lines (58 loc) · 1.43 KB
/
Copy pathdisplaytrain.php
File metadata and controls
64 lines (58 loc) · 1.43 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
53
54
55
56
57
58
59
60
61
62
63
64
<html>
<head>
<link rel="stylesheet" href="./table.css">
<style>
body{
background-image: url("./train13.jpg");
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
table{
width: 50%;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body bgcolor="black">
<br>
<br>
<?php
include "db.php";
$sql = "SELECT * FROM trainform";
$result = $conn->query($sql);
?>
<table>
<tr>
<th>trainno</th>
<th>trainname</th>
<th>source</th>
<th>destination</th>
<th>arrival time</th>
<th>departure time</th>
</tr>
<?php
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td>' . $row['trainno'] . '</td>';
echo '<td>' . $row['trainname'] . '</td>';
echo '<td>' . $row['source'] . '</td>';
echo '<td>' . $row['destination'] . '</td>';
echo '<td>' . $row['arrivaltime'] . '</td>';
echo '<td>' . $row['departuretime'] . '</td>';
// echo "<br> trainname: ". $row["trainname"]. " -trainno: ". $row["trainno"]. " -source: " . $row["source"] . " -destination: " . $row["destination"] . " -arrivaltime: " . $row["arrivaltime"] . " -departuretime :" . $row["departuretime"] . "<br>";
echo '</tr>';
}
} else {
echo "0 results";
}
$conn->close();
?>
</table>
</body>
</html>