-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeath_level.php
107 lines (99 loc) · 3.47 KB
/
death_level.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?PHP
$page_description = "Infection Levels as Percentages of Population";
include_once('menu.php');
global $state_level;
global $maryland_history;
$maryland_history = make_maryland_array();
function case_count($county){
// infected
global $maryland_history;
$date = $maryland_history['date'];
$aka = county_daka($county);
$val = $maryland_history[$date][$aka];
$count = intval($val);
return $count;
}
function total_count($county){
// pouplation
global $covid_db;
$q = "SELECT number_of_people FROM coronavirus_populations where name_of_location = '$county' ";
$r = $covid_db->query($q);
$d = mysqli_fetch_array($r);
return $d['number_of_people'];
}
function infection_levelMD($county){
global $covid_db;
global $state_level;
$cases = case_count($county);
$total = total_count($county);
$gcd = gmp_gcd($cases, $total);
$a = $cases / $gcd;
$b = $total / $gcd;
$c = $cases / $total;
$d = $c * 100;
$state_level = $d;
$e = number_format($d, 5, '.', '');
$covid_db->query("update coronavirus_populations set rate_of_death = '$e' where name_of_location = '$county' ");
echo "<div class='col-sm-6' style='background-color:lightblue; height:150px;'><h3>$county</h3><p><b>Deaths</b> $cases : $total <b>Population</b></p><p><b>Reduced</b> $a : $b</p><p><b>Dead Percent of the Population</b> $e%</p></div><div class='col-sm-6' style='background-color:lightblue; height:150px;'><p><img src='img/Infection_rate_formula.jpg' class='img-rounded'></p></div>";
}
function infection_level($county){
global $covid_db;
global $state_level;
$cases = case_count($county);
$total = total_count($county);
$gcd = gmp_gcd($cases, $total);
$a = $cases / $gcd;
$b = $total / $gcd;
$c = $cases / $total;
$d = $c;
$d = $c * 100;
$e = number_format($d, 5, '.', '');
if($cases == 0){
echo "<div class='col-sm-2' style='background-color:lightgreen;'><h4>COLD <a href='county.php?county=$county'>$county</a></h4><p>$cases : $total</p><p>$a : $b</p><p><b>$e%</b></p></div>";
}elseif($state_level > $d){
echo "<div class='col-sm-2' style='background-color:lightyellow;'><h4><a href='county.php?county=$county'>$county</a></h4><p>$cases : $total</p><p>$a : $b</p><p><b>$e%</b></p></div>";
}else{
echo "<div class='col-sm-2' style='background-color:#ffbaba;'><h4>HOT <a href='county.php?county=$county'>$county</a></h4><p>$cases : $total</p><p>$a : $b</p><p><b>$e%</b></p></div>";
}
$covid_db->query("update coronavirus_populations set rate_of_death = '$e' where name_of_location = '$county' ");
}
?>
<div class="container">
<div class="row">
<?PHP infection_levelMD('Maryland'); ?>
</div>
</div>
<div class="container">
<div class="row">
<?PHP
infection_level('Allegany');
infection_level('AnneArundel');
infection_level('Baltimore');
infection_level('BaltimoreCity');
infection_level('Calvert');
infection_level('Caroline');
?> </div> <div class="row"> <?PHP
infection_level('Carroll');
infection_level('Cecil');
infection_level('Charles');
infection_level('Dorchester');
infection_level('Frederick');
infection_level('Garrett');
?> </div> <div class="row"> <?PHP
infection_level('Harford');
infection_level('Howard');
infection_level('Kent');
infection_level('Montgomery');
infection_level('PrinceGeorges');
infection_level('QueenAnnes');
?> </div> <div class="row"> <?PHP
infection_level('Somerset');
infection_level('StMarys');
infection_level('Talbot');
infection_level('Washington');
infection_level('Wicomico');
infection_level('Worcester');
?>
</div>
</div>
<?PHP include_once('footer.php'); ?>