-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdata2.php
executable file
·73 lines (59 loc) · 2.55 KB
/
getdata2.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
<?php
$db=new SQLite3('cluster.db');
$tsql= "SELECT count(*) FROM clustel";
$indisql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%Indihome%' COLLATE NOCASE";
$firstsql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%Fir%' COLLATE NOCASE";
$mncsql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%MNC%' COLLATE NOCASE";
$indosql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%Indov%' COLLATE NOCASE";
$bizsql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%Biz%' COLLATE NOCASE";
$nextsql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%nex%' COLLATE NOCASE";
$otsql= "SELECT count(*) FROM clustel where KOMPETITOR LIKE '%indosat%' OR KOMPETITOR LIKE '%bo%'
OR KOMPETITOR LIKE '%para%' or KOMPETITOR LIKE '%republic%' or KOMPETITOR LIKE '%oxygen%'
or KOMPETITOR LIKE '%oke%' or KOMPETITOR LIKE '%play%' or KOMPETITOR LIKE '%top%' or KOMPETITOR LIKE '%big%'
or KOMPETITOR LIKE '%k-%' or KOMPETITOR LIKE '%orange%' or KOMPETITOR LIKE '%kabel%'
or KOMPETITOR LIKE '%prima%' or KOMPETITOR LIKE '%cable%'
COLLATE NOCASE";
$nosql= "SELECT count(*) FROM clustel where KOMPETITOR =''";
$result=$db->query($tsql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$total = $row["count(*)"];
$result=$db->query($indisql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$indihome = $row["count(*)"];
$result=$db->query($firstsql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$firstmedia = $row["count(*)"];
$result=$db->query($mncsql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$mnc = $row["count(*)"];
$result=$db->query($indosql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$Indovision = $row["count(*)"];
$result=$db->query($bizsql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$biznet = $row["count(*)"];
$result=$db->query($nextsql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$nextmedia = $row["count(*)"];
$result=$db->query($otsql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$other = $row["count(*)"];
$result=$db->query($nosql);
$row = $result->fetchArray(SQLITE3_ASSOC);
$nodata = $row["count(*)"];
$data=array($indihome,$firstmedia,$mnc,$Indovision,$biznet,$nextmedia,$other,$nodata);
// $bronzesql= "SELECT count(*) FROM clustel where TIPECLUSTER=/"sederhana/" ";
// $result=$db->query($bronzesql);
// $row = $result->fetchArray(SQLITE3_ASSOC);
// $bronze = $row["count(*)"];
// $final = json_decode($final, true);
// $new_final = array();
// // simple flattening
// foreach($final as $value) {
// foreach($value as $sub_value) {
// $new_final[] = $sub_value;
// }
// }
echo json_encode($data);
exit;
?>