-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassengers.php
93 lines (64 loc) · 2.01 KB
/
passengers.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
<?php
include("config.php");
//include('session.php');
$sql = "SELECT * FROM passengers";
$sth = $conn->prepare($sql );
$sth->execute();
$dataAraay = $sth->fetchAll();
$tableHeader = array("ID","email","fullname","gender","phone");
function makeDataTableTable ($tableID,$tableHeader,$tableDatabaseColumns,$dataAraay)
{
//$tableDatabaseColumns = $tableHeader;
echo "<table id= " . $tableID . " class='display' cellspacing='0' width='100%'>" ;
echo '<thead>
<tr> ' ;
foreach ($tableHeader as $HeaderColumn)
{
echo '<th>' . $HeaderColumn . '</th>' ;
}
echo '</tr></thead> ' ;
echo '<tbody>';
// make the body
foreach ($dataAraay as $row) {
echo "<tr>";
foreach ($tableDatabaseColumns as $columnName) {
echo "<td>" . $row[$columnName] . "</td>" ;
}
"</tr>" ;
}
echo '</tbody>' ;
echo "</table>";
}
//echo '<script> $("#drivers").DataTable(); </script>';
$conn = null;
?>
<html>
<head>
<script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" >
<script type="text/javascript">
$(document).ready(function() {
$('#passengers').dataTable();
});
</script>
</head>
<style>
.title {
font-family:Georgia,serif;
color:#4E443C;
font-variant: small-caps; text-transform: none; font-weight: 100; margin-bottom: 0;
margin:auto;
font-size:30px;
text-align: center;
}
</style>
<body>
<?php include('welcome.php'); ?>
<div style="text-align: center;"><br><br>
<span class = "title"> list of passengers </span><br><br>
</div>
<?php $tableID = 'passengers';
makeDataTableTable ($tableID,$tableHeader,$tableHeader,$dataAraay);?>
</body>
</html>