forked from boogiespook/osma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getCountryData.php
38 lines (30 loc) · 1.12 KB
/
getCountryData.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
<?php
include 'dbconnect.php';
connectDB();
$data = array();
$qq = "";
if (isset($_GET['lob']) && $_GET['lob'] != "") {
$qq = "select country as country, count(*) as total from data WHERE lob = '" . $_GET['lob'] . "' group by country order by total desc";
}
if (isset($_GET['country']) && $_GET['country'] != "") {
$qq = "select country as country, count(*) as total from data WHERE country = '" . $_GET['country'] . "' group by country order by total desc";
}
if ($qq == "") {
$qq = "select country as country, count(*) as total from data group by country order by total desc";
}
#print $qq;
$result = mysqli_query($db, $qq);
$i=0;
foreach ($result as $row) {
$data[] = $row;
$i++;
}
# while($row = mysqli_fetch_array($result))
# {
# $point = array("x" => $row['date'], "y" => $row['total']);
# $point = array("x" => $row['country'], "y" => $row['total'], "legendText" => $row['country'], "label" => $row['country']);
# $point = array("x" => $row['date'], "y" => $row['total']);
# array_push($data_points, $point);
# }
echo json_encode($data, JSON_NUMERIC_CHECK);
?>