diff --git a/content/profile.php b/content/profile.php index 3109587..ef6bdf6 100644 --- a/content/profile.php +++ b/content/profile.php @@ -1,5 +1,4 @@ prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } // Verknüpft die übergebenen Parameter exakt mit den SQL-Platzhaltern - $command->execute([ + $success = $command->execute([ ":title" => $title, ":content" => $content, ":author" => $author, @@ -73,10 +76,13 @@ class DatabaseArticleManager implements ArticleManagerDAO { ":tags" => $tags ]); + if (!$success) { + throw new InternalServerErrorException("internal_error"); + } + return intval($db->lastInsertId()); } catch (PDOException $e) { - throw new InternalServerErrorException("internal_error"); } } @@ -321,7 +327,6 @@ class DatabaseArticleManager implements ArticleManagerDAO { } } - /** * Holt alle User-IDs, die einen bestimmten Beitrag geliked haben. *