commit 900f8c0467409af4175419c1ac70a9e6af2495ad
parent ea4796ae5ea0f32d7b8a8eb2defa0b65d4b8679c
Author: LennartSchroot <[email protected]>
Date: Mon, 3 Jul 2023 15:06:49 +0200
final!!!
Diffstat:
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
@@ -6,8 +6,8 @@
<component name="ChangeListManager">
<list default="true" id="f1ac0514-5d96-49e8-8c16-ecccecd1bbe1" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/Model/Key.php" beforeDir="false" afterPath="$PROJECT_DIR$/Model/Key.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/index.php" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/js/map.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/map.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -60,6 +60,7 @@
<workItem from="1688384517492" duration="305000" />
<workItem from="1688384956857" duration="828000" />
<workItem from="1688387080412" duration="1016000" />
+ <workItem from="1688388326819" duration="1107000" />
</task>
<servers />
</component>
diff --git a/Model/Key.php b/Model/Key.php
@@ -8,6 +8,7 @@ class Key
$db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda");
$query = "SELECT humidity, city, date_time
FROM retrieve_facilities
+ WHERE date(date_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 28 DAY) AND CURDATE()
ORDER BY date_time DESC";
$stmt = mysqli_prepare($db, $query);
$stmt->execute();
@@ -60,6 +61,7 @@ class Key
$db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda");
$query = "SELECT distinct wind_chill, date, city
FROM retrieve_zoos
+ WHERE date BETWEEN DATE_SUB(CURDATE(), INTERVAL 28 DAY) AND CURDATE()
ORDER BY date DESC, wind_chill
";
diff --git a/index.php b/index.php
@@ -23,6 +23,8 @@ $router->addRoute(["GET"], "/api/:data", function ($key) {
if($key['data'] == ':3jvl7yb5sRr80s6lTdeOyxV9VTQZkCPRp7bKOWKFWxfL2vhsU4Hhpgcmz9qe0zEk') {
get_windchill();
$db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda");
+ // we halen data op van 2023-06-28 zodat er data word getoond op de homepage en op de map,
+ // bij de echte applicatie waar de data elke dag wordt geupdatet zou hier CURDATE() komen te staan.
$query = "SELECT city, min(wind_chill) as wind_chill, country
FROM retrieve_zoos
WHERE date = '2023-06-28'
@@ -48,6 +50,7 @@ $router->addRoute(["GET"], "/api/:data", function ($key) {
$db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda");
$query = "SELECT distinct humidity, city, date_time
FROM retrieve_facilities
+ WHERE date(date_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 28 DAY) AND CURDATE()
";
$stmt = mysqli_prepare($db, $query);
$stmt->execute();