commit 4a205fa01e1dc2d5dee6fe1814cbbc5798896490
parent 2885258eb990d6fa17996967fd8e833c4bcc2843
Author: LennartSchroot <[email protected]>
Date: Thu, 29 Jun 2023 16:54:12 +0200
queries
Diffstat:
2 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
@@ -5,6 +5,7 @@
</component>
<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$/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/index.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@@ -27,18 +28,18 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
- <component name="PropertiesComponent"><![CDATA[{
- "keyToString": {
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "WebServerToolWindowFactoryState": "false",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "vue.rearranger.settings.migration": "true"
+ <component name="PropertiesComponent">{
+ "keyToString": {
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "WebServerToolWindowFactoryState": "false",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "vue.rearranger.settings.migration": "true"
}
-}]]></component>
+}</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@@ -49,6 +50,7 @@
<updated>1688047905882</updated>
<workItem from="1688047906916" duration="295000" />
<workItem from="1688048224856" duration="968000" />
+ <workItem from="1688049596887" duration="774000" />
</task>
<servers />
</component>
diff --git a/index.php b/index.php
@@ -21,9 +21,10 @@ $router->addRoute(["GET"], "/api/:data", function ($key) {
$weather_data = [];
if($key['data'] == ':3jvl7yb5sRr80s6lTdeOyxV9VTQZkCPRp7bKOWKFWxfL2vhsU4Hhpgcmz9qe0zEk') {
$db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda");
- $query = "SELECT distinct wind_chill, city, country
+ $query = "SELECT city, min(wind_chill) as wind_chill, country
FROM retrieve_zoos
WHERE date = '2023-06-28'
+ group by city, country
";
$stmt = mysqli_prepare($db, $query);
@@ -40,26 +41,18 @@ $router->addRoute(["GET"], "/api/:data", function ($key) {
header('Content-Type: application/json');
echo json_encode($weather_data);
} elseif($key['data'] == ':ae9c50dc5cd58c538a0d6aedb17fffedcaffd568d22381dab3ae72baaeb24684') {
- $db = new mysqli("86.92.67.21", "friedel", "hailiwa", "wap2");
+ $db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda");
$weather_data = [];
- $query = "SELECT distinct temperature, dew_point, nl.name as city, date_time
- FROM weather_data wd
- JOIN station s ON wd.station_name = s.name
- JOIN contract_station cs ON cs.station_name = s.name
- JOIN nearestlocation nl ON nl.station_name = s.name
- JOIN country co ON co.country_code = nl.country_code
- JOIN geolocation geo ON geo.country_code = co.country_code
- JOIN contract c ON cs.contract_id = c.contract_id
- WHERE c.token = 'ae9c50dc5cd58c538a0d6aedb17fffedcaffd568d22381dab3ae72baaeb24684'
+ $query = "SELECT distinct humidity, city, date_time
+ FROM retrieve_facilities
";
$stmt = mysqli_prepare($db, $query);
$stmt->execute();
$data = $stmt->get_result();
while ($row = $data->fetch_assoc()) {
- $humidity = Model\Formula::humid($row["temperature"], $row["dew_point"]);
$weather_data[] = [
- 'humidity' => $humidity,
+ 'humidity' => $row['humidity'],
'location' => $row['city'],
'datetime' => $row['date_time']
];