From 072744998c9eaf61b3743adb109270923ba962af Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Wed, 21 Dec 2022 10:59:26 +0100 Subject: [PATCH 1/2] add: comment --- BancaDati/BancaDati.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BancaDati/BancaDati.php b/BancaDati/BancaDati.php index 0a81b46..9701740 100644 --- a/BancaDati/BancaDati.php +++ b/BancaDati/BancaDati.php @@ -29,6 +29,15 @@ class BancaDati { $data[8] = chr(ord($data[8]) & 0x3f | 0x80); return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } + + /** + * Einheitliche Update Funktion + * @param string $table + * @param string $id + * @param array $values + * @return void + * @author Malte Schulze Hobeling + */ public function update(string $table, string $id, array $values){ $value = ""; foreach ($values as $col => $v){ 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 2/2] 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