From b8562a50e06a32a6f9a03ad1baaf783c0ef6a0a1 Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Wed, 21 Dec 2022 11:03:37 +0100 Subject: [PATCH] add: einheitliche delete funktion --- BancaDati/BancaDati.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/BancaDati/BancaDati.php b/BancaDati/BancaDati.php index 9701740..615b922 100644 --- a/BancaDati/BancaDati.php +++ b/BancaDati/BancaDati.php @@ -53,4 +53,21 @@ class BancaDati { die; } } + + /** + * Einheitliche Delete Funktion + * @param string $table + * @param string $id + * @return void + * @author Malte Schulze Hobeling + */ + public function delete(string $table, string $id){ + $sql = "DELETE FROM " . $table . " WHERE `id` = " . $id . ";"; + try { + $sth = $this->pdo->prepare($sql); + $sth->execute(); + }catch (\PDOException $e){ + die; + } + } } \ No newline at end of file