Download Previous Project Report
Transcript
Appendix D: index.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.
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title> Sample Weather Information </title>
</head>
<body>
<div class="outer">
<div id="banner">
<span><br>HOBO Weather Station</span>
</div>
<div id="menu">
<ul>
<li><a href="http://okeen.spoatacus.com/hobo/">Home</a></li>
<li><a href="http://okeen.spoatacus.com/hobo/graph.php">Graphs</a></li>
<li><a href="http://okeen.spoatacus.com/hobo/about.html">About</a></li>
<li><a href="http://okeen.spoatacus.com/hobo/contact.html">Contact us</a></li>
</ul>
</div>
<?php
$dbhost = 'mysql.spoatacus.com';
$dbuser = 'okeen';
$dbpass = '2CbhJuL#';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
connecting to mysql');
('Error
$dbname = 'okeen_hobo';
mysql_select_db($dbname);
?>
<?php
$query = "SELECT timestamp, pressure, temperature, rh FROM sensor_temp ORDER BY timestamp
DESC LIMIT 1";
34. $result = mysql_query($query);
35. $row = mysql_fetch_array($result, MYSQL_ASSOC);
36.
37.
echo "<h3> Current Weather Station Sensor Reading</h3>";
38.
echo "Time : {$row['timestamp']} <br>" .
39.
"Pressure : {$row['pressure']} <br>" .
40.
"Temperature : {$row['temperature']} <br>" .
41.
"Relative Humidity : {$row['rh']} <br>";
42. ?>
43. </div>
44. </body>
45.
46. </html>
69