From f459f4d4a19a55984409172abe1c36cd3c838e68 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Wed, 15 Feb 2023 17:26:23 +0100 Subject: [PATCH] DataDownload --- dataCollector/dataCollector.php | 12 +++++++++--- dataCollector/download.php | 4 ---- index.html | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 dataCollector/download.php diff --git a/dataCollector/dataCollector.php b/dataCollector/dataCollector.php index 9b8a6ec..66f22d4 100644 --- a/dataCollector/dataCollector.php +++ b/dataCollector/dataCollector.php @@ -43,8 +43,14 @@ function saveToDatabase($contentArray, $conn) { return; } -function getFromDatabase() { - return []; +function getFromDatabase($conn) { + $sql = "SELECT `id`, `firstSave`, `lastSave`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD` FROM `topics`"; + $result = $conn->query($sql); + $dataArray = Array(); + while($row = $result->fetch_assoc()) { + array_push($dataArray, [$row["id"],$row["firstSave"],$row["lastSave"],$row["fullJSON"],$row["timeWatchM"],$row["timeWatchW"],$row["timeWatchD"],$row["countWatchM"],$row["countWatchW"],$row["countWatchD"]]); + } + return $dataArray; } $entityBody = '{"lastSave": 0, "timeWatchM": 0, "timeWatchW": 0, "timeWatchD": 0, "countWatchM": 0, "countWatchW": 0, "countWatchD": 0, "id":"test","watches":[{"actions":[]},{"actions":[]},{"actions":[]}]}'; @@ -61,7 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } } } elseif($_SERVER['REQUEST_METHOD'] === 'GET') { - download_xlsxFile(getFromDatabase()); + download_xlsxFile(getFromDatabase($conn)); } else { echo "invalid Request.
Type: ".$_SERVER['REQUEST_METHOD']; } diff --git a/dataCollector/download.php b/dataCollector/download.php deleted file mode 100644 index cefdb28..0000000 --- a/dataCollector/download.php +++ /dev/null @@ -1,4 +0,0 @@ -

Genderwatch-protocol

- Anonyme Daten herunterladen (aktuell in Entwicklung) + Anonyme Daten herunterladen (aktuell in Entwicklung)

Aktuelles Thema