course-seite vorbereitung

This commit is contained in:
2025-07-11 09:50:45 +02:00
parent 509c685d80
commit c8499aa9d5
4 changed files with 92 additions and 15 deletions

22
Model/CourseModel.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace Blog\Model;
use Blog\Model\Database;
use PDOException;
use Random\RandomException;
class CourseModel extends Database
{
public function getCourseById(string $id){
$pdo = $this->linkDB();
$sql = "SELECT k.*, o.stadt, o.strasse, o.plz
FROM kurs k
JOIN ort o ON k.ort_id = o.id
WHERE k.id = :id";
$sth = $pdo->prepare($sql);
$sth->execute([':id' => $id]);
$result = $sth->fetch(\PDO::FETCH_ASSOC);
return $result ?? null;
}
}