Skip to content

Instantly share code, notes, and snippets.

View BotezatuAndreea's full-sized avatar

BotezatuAndreea

View GitHub Profile
@BotezatuAndreea
BotezatuAndreea / gist:6823a96b4b5282dad7e042113cfaf295
Created December 17, 2019 13:34
Displaying the AQI graph for the last 24 hours and the decision support component.
/ ==== Graph === /
echo '<div class="wrap">';
$sqlaqi = "SELECT * FROM aqitable ORDER BY timestamp desc LIMIT 24";
$result = $conn->query($sqlaqi);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$aqivalue = $row["aqi"];
@BotezatuAndreea
BotezatuAndreea / gist:20d9edbbbeb903a56b2d8dca19663683
Created December 17, 2019 13:33
Storing the values calculated above
$servername = "xx.xxx.xxx.xxx";
$username = "xxxxxxxxxxxx";
$password = "xxxxxxxxxxxx";
$dbname = "xxxxxxxxxxxxxx";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
@BotezatuAndreea
BotezatuAndreea / gist:6938eb9bb45907c80c6f8b8576720fcb
Created December 17, 2019 13:32
Application of the air quality index calculation algorithm
if ($medaritno2 < 0.106) {
$kmaxno2 = 1;
}
if ($medaritno2 >= 0.107 AND $kmax <= 0.121) {
$kmaxno2 = 2;
}
if ($medaritno2 >= 0.213 AND $kmax <= 0.319) {
$kmaxno2 = 3;
@BotezatuAndreea
BotezatuAndreea / query for connection verification with GW database
Created December 17, 2019 13:32
Extracting data from GM Meshlium’s MySQL database
$servername = "82.xx.xx.xxx";
$username = "xxxxxxxxxx";
$password = "xxxxxxxxxx";
$dbname = "MeshliumDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);