course-seite vorbereitung
This commit is contained in:
22
Model/CourseModel.php
Normal file
22
Model/CourseModel.php
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user