-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet_Lowest_Humidity.php
More file actions
102 lines (93 loc) · 2.49 KB
/
Copy pathGet_Lowest_Humidity.php
File metadata and controls
102 lines (93 loc) · 2.49 KB
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
<html>
<body style="background-color:powderblue;">
<style>
h1 {text-align: center;}
body {background-color: powderblue;}
h1 {color: c61f0c;}
p {color: yellow;
font-family: Verdana;
font-size: 200%;
}
input[type=submit] {
width: 20em; height: 2em;
}
input[type=button], input[type=submit], input[type=reset] {
background-color:#00002B;
border: none;
color: white;
padding: 16px 32px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
font-size: 160%;
top: 150%;
left: 150%;
-ms-transform: translate(+80%, +80%);
transform: translate(+80%, +80%);
}
body {
background-image: url('blue.jpg');
background-repeat: no-repeat;
background-size: cover;
background-size: 100% 300%;
}
</style>
<h2>Lowest Humidity </h2>
<?php
$servername = "localhost";
$username = "bojan";
$password = "pijanista";
$dbname = "Temperature_Humidity";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, Temperature, Humidity, reg_date FROM Temperature_Humidity ORDER BY Temperature LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. "<br>";
echo "Temperature: " .$row["Temperature"]. "<br>";
echo " Humidity: " . $row["Humidity"]. "<br>";
echo "Time and date: " .$row["reg_date"]. "<br>";
}
} else {
echo "0 results";
}
$sql = "SELECT id, Temperature, Humidity, reg_date FROM Temperature_Humidity ORDER BY Humidity DESC LIMIT 1";
$result = $conn->query($sql);
echo "<br>";
$conn->close();
?>
<h2>Highest Humidity </h2>
<?php
$servername = "localhost";
$username = "bojan";
$password = "pijanista";
$dbname = "Temperature_Humidity";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, Temperature, Humidity, reg_date FROM Temperature_Humidity ORDER BY Humidity DESC LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. "<br>";
echo "Temperature: " .$row["Temperature"]. "<br>";
echo " Humidity: " . $row["Humidity"]. "<br>";
echo "Time and date: " .$row["reg_date"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>