-
Notifications
You must be signed in to change notification settings - Fork 1
/
seasonlydisease.php
61 lines (43 loc) · 1.46 KB
/
seasonlydisease.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 Season, AVG(Dengue_Cases) as avgdeng from ".$table_name." GROUP BY Season;";
//echo $query1;
$deng_cases_by_year = $con->query($query1);
while($row = mysqli_fetch_array($deng_cases_by_year)){
/*echo $row['district']."</br>";*/
$dengue_cases[] = floatval($row['avgdeng']);
$season[] = $row['Season'];
};
//print_r($dengue_cases) ;
}
# flu_cases
$flu_cases = array();
$query2="select Season, AVG(Flu_Cases) as avgflu from ".$table_name." GROUP BY Season;";
$flu_cases_by_year = $con->query($query2);
while($row = mysqli_fetch_array($flu_cases_by_year)){
/*echo $row['district']."</br>";*/
$flu_cases[] = floatval($row['avgflu']);
$season[] = $row['Season'];
};
//print_r($flu_cases) ;
#typhoid_cases
$typhoid_cases = array();
$query3="select Season, AVG(Typhoid) as avgtyphoid from ".$table_name." GROUP BY Season;";
$typhoid_cases_by_year = $con->query($query3);
while($row = mysqli_fetch_array($typhoid_cases_by_year)){
/*echo $row['district']."</br>";*/
$typhoid_cases[] = floatval($row['avgtyphoid']);
$season[] = $row['Season'];
};
//print_r($typhoid_cases) ;
include "seasonlygraph.php";
?>