hanze/iwa-panda2

database werkt joepie (6f93314c9d6099b298edf10bd75d1bfe8116bdde)
Repositories | README.md

commit 6f93314c9d6099b298edf10bd75d1bfe8116bdde
parent d47fe86e841043e405d9e2ac36b92749b2d99329
Author: LennartSchroot <[email protected]>
Date:   Mon,  3 Jul 2023 14:02:54 +0200

database werkt joepie

Diffstat:
M.idea/workspace.xml7++++---
MController/api/api.php10++++++----
DController/hdata/hdata.php5-----
3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/.idea/workspace.xml b/.idea/workspace.xml @@ -5,11 +5,9 @@ </component> <component name="ChangeListManager"> <list default="true" id="f1ac0514-5d96-49e8-8c16-ecccecd1bbe1" name="Changes" comment=""> - <change afterPath="$PROJECT_DIR$/Model/Connect.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Controller/api/api.php" beforeDir="false" afterPath="$PROJECT_DIR$/Controller/api/api.php" 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$/Controller/hdata/hdata.php" beforeDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -58,6 +56,9 @@ <workItem from="1688051125887" duration="668000" /> <workItem from="1688051801098" duration="1872000" /> <workItem from="1688053996805" duration="1600000" /> + <workItem from="1688382982148" duration="967000" /> + <workItem from="1688384517492" duration="305000" /> + <workItem from="1688384956857" duration="576000" /> </task> <servers /> </component> diff --git a/Controller/api/api.php b/Controller/api/api.php @@ -3,16 +3,17 @@ function storeZooData($dataArray): void{ if ($dataArray != '') { $db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda"); - $query = "INSERT INTO retrieve_zoos (city, wind_chill, date, country) VALUES (?, ?, ?, ?)"; + $query = "INSERT IGNORE INTO retrieve_zoos (data_id, city, wind_chill, date, country) VALUES (?, ?, ?, ?, ?)"; $stmt = mysqli_prepare($db, $query); foreach ($dataArray as $data) { + $data_id = $data->data_id; $city = $data->city; $windchill = $data->windchill; $date = $data->date; $country = $data->country; - $stmt->bind_param("sdss", $city, $windchill, $date, $country); + $stmt->bind_param("isdss", $data_id, $city, $windchill, $date, $country); $stmt->execute(); } @@ -24,15 +25,16 @@ function storeZooData($dataArray): void{ function storeFacData($dataArray): void{ if ($dataArray != '') { $db = new mysqli("86.92.67.21", "friedel", "hailiwa", "panda"); - $query = "INSERT INTO retrieve_facilities (city, date_time, humidity) VALUES (?, ?, ?)"; + $query = "INSERT IGNORE INTO retrieve_facilities (data_id, city, date_time, humidity) VALUES (?, ?, ?, ?)"; $stmt = mysqli_prepare($db, $query); foreach ($dataArray as $data) { + $data_id = $data->data_id; $city = $data->city; $humidity = $data->humidity; $date_time = $data->date_time; - $stmt->bind_param("ssd", $city, $date_time, $humidity); + $stmt->bind_param("issd", $data_id, $city, $date_time, $humidity); $stmt->execute(); } diff --git a/Controller/hdata/hdata.php b/Controller/hdata/hdata.php @@ -1,5 +0,0 @@ -<?php - -function make_table() -{ -}