diff --git a/Controller/CourseController.php b/Controller/CourseController.php index 8d2a6f2..976a098 100644 --- a/Controller/CourseController.php +++ b/Controller/CourseController.php @@ -13,7 +13,7 @@ class CourseController{ $this->view = $view; } - public function showCoursePage(){ + public function showCourse(){ $id = $_GET["courseId"] ?? null; if(!$id){ header('Location: index.php'); diff --git a/Model/CourseModel.php b/Model/CourseModel.php index 79cde89..ecb0a49 100644 --- a/Model/CourseModel.php +++ b/Model/CourseModel.php @@ -10,9 +10,11 @@ class CourseModel extends Database { public function getCourseById(string $id){ $pdo = $this->linkDB(); - $sql = "SELECT k.*, o.stadt, o.strasse, o.plz + $sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id, + o.stadt, o.strasse, o.plz, b.note, b.kommentar FROM kurs k JOIN ort o ON k.ort_id = o.id + LEFT JOIN bewertungen AS b ON b.kurs_id = k.id WHERE k.id = :id"; $sth = $pdo->prepare($sql); $sth->execute([':id' => $id]); diff --git a/Views/Course/showCourse.phtml b/Views/Course/showCourse.phtml index 27802a6..26c41dc 100644 --- a/Views/Course/showCourse.phtml +++ b/Views/Course/showCourse.phtml @@ -4,15 +4,15 @@ include dirname(__DIR__).'/header.phtml';
Bewertung: = $kurs['bewertung'] ?> ★
+Bewertung: = $kurs['note'] ?> ★
Preis: = htmlspecialchars($kurs['preis']) ?>€
-Kursleiter: = htmlspecialchars($kurs['leiter']) ?>
Adresse: = htmlspecialchars($kurs['strasse']) ?>, = htmlspecialchars($kurs['plz']) ?> = htmlspecialchars($kurs['stadt']) ?>
= nl2br(htmlspecialchars($kurs['beschreibung'] ?? '')) ?>
- ‹ Zurück zur Kursübersicht - + ‹ Zurück zur KursübersichtKeine Kurse gefunden.
'; } @@ -102,8 +101,6 @@ $location = $_GET['location'] ?? '';