From 1f2789eead5642d4822e23811f973e4907b8a5ce Mon Sep 17 00:00:00 2001 From: Samuel Wolff Date: Thu, 18 Jan 2024 10:12:14 +0100 Subject: [PATCH 1/3] Tagesplan first Stand --- Model/TagesplanModel.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Model/TagesplanModel.php b/Model/TagesplanModel.php index d760184..b25ba41 100644 --- a/Model/TagesplanModel.php +++ b/Model/TagesplanModel.php @@ -69,7 +69,23 @@ class TagesplanModel extends Database public function getGerichteOnTag() { + $pdo = $this->linkDB(); + $datum = $_GET["datum"]; + + $sql = "SELECT * FROM Tagesplan LEFT JOIN GibtsAm ON Tagesplan.id = GibtsAm.tid LEFT JOIN Gericht ON GibtsAm.gid = Gericht.id WHERE Tagesplan.datum = $datum"; + + try { + $stmt = $pdo->prepare($sql); + $stmt->execute(); + } catch (\PDOException $e) { + echo $sql . " This do be faulty"; + return false; + } + + $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); + + return $result; } } From 34ae68bfdcf19cccc0f02702de59c831636146f0 Mon Sep 17 00:00:00 2001 From: Samuel Wolff Date: Thu, 18 Jan 2024 10:16:56 +0100 Subject: [PATCH 2/3] zweiter Stand --- Model/TagesplanModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/TagesplanModel.php b/Model/TagesplanModel.php index b25ba41..80d0793 100644 --- a/Model/TagesplanModel.php +++ b/Model/TagesplanModel.php @@ -73,7 +73,7 @@ class TagesplanModel extends Database $datum = $_GET["datum"]; - $sql = "SELECT * FROM Tagesplan LEFT JOIN GibtsAm ON Tagesplan.id = GibtsAm.tid LEFT JOIN Gericht ON GibtsAm.gid = Gericht.id WHERE Tagesplan.datum = $datum"; + $sql = "SELECT * FROM Gericht LEFT JOIN GibtsAm ON Gericht.id = GibtsAm.gid LEFT JOIN Tagesplan ON GibtsAm.tid = Tagesplan.id WHERE Tagesplan.datum = $datum"; try { $stmt = $pdo->prepare($sql); From 64b6aa2716bd3515d0b333016ca01429888905c4 Mon Sep 17 00:00:00 2001 From: Samuel Wolff Date: Thu, 18 Jan 2024 10:21:52 +0100 Subject: [PATCH 3/3] sql funzt --- Model/TagesplanModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/TagesplanModel.php b/Model/TagesplanModel.php index 80d0793..84db2ad 100644 --- a/Model/TagesplanModel.php +++ b/Model/TagesplanModel.php @@ -73,7 +73,7 @@ class TagesplanModel extends Database $datum = $_GET["datum"]; - $sql = "SELECT * FROM Gericht LEFT JOIN GibtsAm ON Gericht.id = GibtsAm.gid LEFT JOIN Tagesplan ON GibtsAm.tid = Tagesplan.id WHERE Tagesplan.datum = $datum"; + $sql = "SELECT Gericht.id, Gericht.name, Gericht.preis, Gericht.beschreibung FROM Gericht LEFT JOIN GibtsAm ON Gericht.id = GibtsAm.gid LEFT JOIN Tagesplan ON GibtsAm.tid = Tagesplan.id WHERE Tagesplan.datum = '$datum'"; try { $stmt = $pdo->prepare($sql);