-
Notifications
You must be signed in to change notification settings - Fork 0
/
phptohtml.php
71 lines (61 loc) · 1.22 KB
/
phptohtml.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
<?php
$DB_USER = "id6023747_thefarmerclub"; // Your database user name
$DB_PASSWORD = "thefarmerclub"; // Your database password (mention your db password here)
$DB_DATABASE ="id6023747_thefarmerclub"; // Your database name
$DB_SERVER ="localhost";
// db server (Mostly will be 'local' host)
$conn=mysqli_connect($DB_SERVER,$DB_USER,$DB_PASSWORD,$DB_DATABASE)
?>
<!DOCTYPE html>
<html>
<head>
<style>
table
{
border:2px solid black;
border-collapse: collapse;
width=50%;
}
th,td
{
border:1px solid black;
padding:5px;
text-align:center;
}
th
{
background-color:gray;
}
</style>
</head>
<body>
<?php
$sql="SELECT *FROM weather ORDER BY id DESC LIMIT 1;";
function executeQuery()
{
$result=mysqli_query($conn,$sql)};
?>
<h1>*****Godrej*****</h1>
<table>
<caption>Sensor data from equipment</caption>
<thead>
<tr>
<th>SR.NO</th>
<th>DATA 1</th>
<th>DATA 2</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($result))
{
echo '<tr>
<td>'.$row['id'].'</td>
<td>'.$row['temp'].'</td>
<td>'.$row['hum'].'</td>
</tr>';
}
?>
</table>
</body>
</html>