-
Notifications
You must be signed in to change notification settings - Fork 0
/
passens.php
75 lines (64 loc) · 1.48 KB
/
passens.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
<?php
include 'header.php';
?>
<html lang="en">
<head>
<style>
table, th, td {
border: 1px solid black;
text-align: center;
font-size: 25px;
}
</style>
</head>
<body>
<div class="flex-container">
<div id="header">
</div>
<form method="POST" style="text-align:center">
<h1>Passenger Information Search</h1>
<b>Search By Passenger_Id :</b><br>
<input name="search_id" value="" type="number"><br><br>
<input value="Go" type="submit">
</form>
<article class="article">
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db_car";
$id="";
if(isset($_POST["search_id"])){
$id=$_POST["search_id"];
}
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT Passenger_Id,Journey_Date FROM tbl_passenger where Passenger_Id='$id'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
echo "<table border=1>";
echo "<tr><th>Passenger_Id</th><th>Journey_Date</th></tr>";
while($row = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>". $row["Passenger_Id"]. "</td><td>" .$row["Journey_Date"]."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
mysqli_close($conn);
?>
</div>
<br><br><br><br><br>
</article>
</body>
</html>
<?php
include 'footer.php';
?>