<?php

require_once "./MySQLiWrapper.php";
require_once "./CalcHumidity.php";
$calc = new CalcHumidity();
// Connect to the database
$db_wrapper = new MySQLiWrapper("localhost", "root", "", "unwdmi");
// Select rows from stations
$result = $db_wrapper->query("SELECT stn, name, country, latitude, longitude \n\t\t\t\t\t\t\t      FROM stations \n\t\t\t\t\t\t\t      WHERE stn={$_GET['stn']}");
$row = mysql_fetch_row($result);
echo "\n\t<tr>\n\t\t<td>\n\t\t\t<table id='station-info'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>STN</th>\n\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t<th>Country</th>\n\t\t\t\t\t<th>Latitude</th>\n\t\t\t\t\t<th>Longitude</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$row[0]}</td>\n\t\t\t\t\t<td>{$row[1]}</td>\n\t\t\t\t\t<td>{$row[2]}</td>\n\t\t\t\t\t<td>{$row[3]}</td>\n\t\t\t\t\t<td>{$row[4]}</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>";
$result = $db_wrapper->query("SELECT datetime, TEMP, DEWP\n\t\t\t\t\t\t\t      FROM measurements\n\t\t\t\t\t\t\t      WHERE STN={$_GET['stn']}\n\t\t\t\t\t\t\t      ORDER BY datetime DESC\n\t\t\t\t\t\t\t      LIMIT 30");
echo "\n\t<tr>\n\t\t<td>\n\t\t\t<table id='measurements'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Datetime</th>\n\t\t\t\t\t<th>Tempatureā„ƒ</th>\n\t\t\t\t\t<th>Humidity%</th>\n\t\t\t\t</tr>";
while ($row = mysql_fetch_assoc($result)) {
    echo "<tr>";
    echo "<td>{$row['datetime']}</td>";
    echo "<td>{$row['TEMP']}</td>";
    echo "<td>" . $calc->calcSingle($row['TEMP'], $row['DEWP']) . "</td>";
    echo "</tr>";
}
echo "\n\t\t\t</table>\n\t\t</td>\n\t</tr>";
Example #2
0
<?php

require_once "./MySQLiWrapper.php";
require_once "./CalcHumidity.php";
require_once "./Export.php";
include "../class/user.php";
session_start();
if (!isset($_SESSION['user'])) {
    header("Location: login.php");
}
$conn = new MySQLiWrapper();
$calculator = new CalcHumidity();
$temperature = $conn->getTop10Temperature();
$now = new DateTime();
//Datetime met huidige datum + tijd
$time = $conn->getLastestTopHumidity();
//Query om de tijd dat tophumidity voor het laatst is geuplade te acherhalen.
$OldestTime = mysql_fetch_assoc($time);
//Stop de tijd in een variable
$lastCalcMoment = new DateTime($OldestTime["datetime"]);
//Omdat mysql_query het terug stuurt als een string moet het convert worden naar een datetime
// get difference between the two dates
$difference = $now->diff($lastCalcMoment);
//Berekend het verschil
if ($difference->h >= 1) {
    // ->i zijn de minuten. Dit betekent dat elke 30 min de top 10 humidity wordt geupdate
    $calculator->calc();
    //Roep de Calchumidity klasse aan en bereken de top 10 humdiity.
}
$humidity = $conn->getTop10Humdity();
//Query de top 10 humidity.
Example #3
0
<?php

require_once "./CalcHumidity.php";
require_once "./MySQLiWrapper2.php";
include "ccs.php";
//include "menu.php";
$conn = new MySQLiWrapper2();
$calculator = new CalcHumidity();
$station = "787620";
$station_data = $conn->getStation($station);
$page = $_SERVER['PHP_SELF'];
$sec = "60";
?>
<link rel="stylesheet" type="text/css" href="table.css">
<meta http-equiv="refresh" content="<?php 
echo $sec;
?>
;URL='<?php 
echo $page;
?>
'">


    <h2 class="sub-header">Station</h2>
        <table class="table table-bordered">
            <thead>
                <tr class="something1">
                    <th class="col-md-1">Station name</th>
                    <th class="col-md-1">Country</th>
                    <th class="col-md-1">latitude</th>
                    <th class="col-md-1">Longitude</th>