Standardmethoden für Standort und News.Events erweitert

This commit is contained in:
2025-06-23 11:10:46 +02:00
parent 6e3e3708b2
commit 1964cadd8c
10 changed files with 278 additions and 3 deletions

View File

@@ -6,8 +6,19 @@ use PDOException;
class EventModel extends Database {
public function showEvents() {
public function getEvents() {
$pdo = $this->linkDB();
$sql = "SELECT * from ausstellung ORDER BY datum_von DESC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
$erg = $sth->fetchAll(\PDO::FETCH_ASSOC);
return $erg;
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
die;
}
}
public function updateEvent($event) {
@@ -77,7 +88,7 @@ class EventModel extends Database {
$sth = $pdo->prepare($sql);
$sth->execute($params);
$erg = $sth->fetchAll(\PDO::FETCH_ASSOC);
return $erg[0];
return $erg;
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
die;