-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiltermonth.php
More file actions
103 lines (102 loc) · 5.3 KB
/
filtermonth.php
File metadata and controls
103 lines (102 loc) · 5.3 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
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
<?php
//filter.php
if(isset($_POST["from_month"], $_POST["to_month"]))
{
$servername = "localhost";
$username = "p_f21_16";
$password = "e3m6rq";
$dbname = "p_f21_16_db";
$conn = new mysqli($servername, $username, $password, $dbname);
$output = '';
$query = "SELECT * FROM AnnualReportData INNER JOIN AnnualReportDataExited ON AnnualReportData.Month=AnnualReportDataExited.Month WHERE AnnualReportData.ID BETWEEN '".$_POST["from_month"]."' AND '".$_POST["to_month"]."'";
$result = mysqli_query($conn, $query);
$output .= '
<table class="table table-bordered">
<tr>
<th width="5%">Month</th>
<th width="10%">People Entered</th>
<th width="30%">People Exited</th>
</tr>
';
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'. $row["Month"] .'</td>
<td>'. $row["PeopleEntered"] .'</td>
<td>'. $row["PeopleExited"] .'</td>
</tr>
';
}
}
else
{
$output .= '
<tr>
<td colspan="5">No Order Found</td>
</tr>
';
}
$output .= '</table>';
echo $output;
}
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['bar']});
google.charts.setOnLoadCallback(drawStuff);
function drawStuff() {
var data = new google.visualization.arrayToDataTable([
['Month', 'People Entered', 'People Exited'],
<?php
$sql = "SELECT * FROM AnnualReportData INNER JOIN AnnualReportDataExited ON AnnualReportData.Month=AnnualReportDataExited.Month WHERE AnnualReportData.ID BETWEEN '".$_POST["from_month"]."' AND '".$_POST["to_month"]."'";
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)){
echo "['".$row['Month']."',".$row['PeopleEntered'].",".$row['PeopleExited']."],";
}
?>
]);
var options = {
width: 800,
chart: {
title: 'Annual Traffic Report Enter/Exit',
subtitle: 'People entered on the left, people exited on the right'
},
bars: 'vertical', // Required for Material Bar Charts.
series: {
0: { axis: 'entered' }, // Bind series 0 to an axis named 'distance'.
1: { axis: 'exited' } // Bind series 1 to an axis named 'brightness'.
},
axes: {
x: {
entered: {label: 'people'}, // Bottom x-axis.
exited: {side: 'top', label: 'Annual Traffic data of enter/exit'} // Top x-axis.
}
}
};
var chart = new google.charts.Bar(document.getElementById('dual_x_div'));
chart.draw(data, options);
};
</script>
</head>
<body>
<div id="dual_x_div" style="width: 1000px; height: 700px;"></div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
</body>
</html>