-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrder_by_Temperature.php
More file actions
65 lines (58 loc) · 1.47 KB
/
Copy pathOrder_by_Temperature.php
File metadata and controls
65 lines (58 loc) · 1.47 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
<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('temperature_order.jpg');
background-size: cover;
background-size: 100% 200%;
}
</style>
<?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";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Temperature: " . $row["Temperature"]. " Humidity: " . $row["Humidity"] . " Date and time: " . $row["reg_date"] ." <br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>