-
Notifications
You must be signed in to change notification settings - Fork 1
/
monthlydisease.php
61 lines (43 loc) · 1.45 KB
/
monthlydisease.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
<?php
include "connection.php";
// Group by year
$month = array();
$year = array();
$region = array();
$season = array();
$table_name="disease";
# dengue_cases
if(!isset($disease['Dengue_Cases'])){
$dengue_cases = array();
$query1="select Month, AVG(Dengue_Cases) as avgdeng from ".$table_name." GROUP BY Month;";
//echo $query1;
$deng_cases_by_month = $con->query($query1);
while($row = mysqli_fetch_array($deng_cases_by_month)){
/*echo $row['district']."</br>";*/
$dengue_cases[] = floatval($row['avgdeng']);
$month[] = $row['Month'];
};
//print_r($dengue_cases) ;
}
# flu_cases
$flu_cases = array();
$query2="select Month, AVG(Flu_Cases) as avgflu from ".$table_name." GROUP BY Month;";
$flu_cases_by_month = $con->query($query2);
while($row = mysqli_fetch_array($flu_cases_by_month)){
/*echo $row['district']."</br>";*/
$flu_cases[] = floatval($row['avgflu']);
$month[] = $row['Month'];
};
//print_r($flu_cases) ;
#typhoid_cases
$typhoid_cases = array();
$query3="select Month, AVG(Typhoid) as avgtyphoid from ".$table_name." GROUP BY Month;";
$typhoid_cases_by_month = $con->query($query3);
while($row = mysqli_fetch_array($typhoid_cases_by_month)){
/*echo $row['district']."</br>";*/
$typhoid_cases[] = floatval($row['avgtyphoid']);
$month[] = $row['Month'];
};
//print_r($typhoid_cases) ;
include "monthlygraph.php";
?>