-
Notifications
You must be signed in to change notification settings - Fork 5
/
getLoBData.php
33 lines (26 loc) · 987 Bytes
/
getLoBData.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
<?php
include 'dbconnect.php';
connectDB();
$qq = "";
if (isset($_GET['country']) && $_GET['country'] != "") {
$qq = "select lob as Industry, count(*) as Total from data WHERE country = '" . $_GET['country'] . "' group by lob order by total desc";
}
if (isset($_GET['lob']) && $_GET['lob'] != "") {
$qq = "select lob as Industry, count(*) as Total from data WHERE lob = '" . $_GET['lob'] . "' group by lob order by total desc";
}
if ((isset($_GET['lob']) && $_GET['lob'] != "") && isset($_GET['country']) && $_GET['country'] != "") {
$qq = "select lob as Industry, count(*) as Total from data WHERE lob = '" . $_GET['lob'] . "' and country = '" . $_GET['country'] . "' group by lob order by total desc";
}
if ($qq == "") {
$qq = "select lob as Industry, count(*) as Total from data group by lob order by total desc";
}
#print $qq;
$result = mysqli_query($db, $qq);
$data = array();
$i=0;
foreach ($result as $row) {
$data[] = $row;
$i++;
}
print json_encode($data);
?>