From 47432f9ae57d595f7a7f34527b1d0a5bb6bd0187 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Fri, 6 Dec 2024 22:43:01 +0100 Subject: [PATCH] ReportQueries.php: add deleteByPost --- inc/Data/ReportQueries.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inc/Data/ReportQueries.php b/inc/Data/ReportQueries.php index 4488a20c..682ed917 100644 --- a/inc/Data/ReportQueries.php +++ b/inc/Data/ReportQueries.php @@ -205,6 +205,17 @@ class ReportQueries { $query->execute(); } + /** + * Deletes all reports from of the given post. + * + * @param int $post_id The post's id. + */ + public function deleteByPost(int $post_id) { + $query = $this->pdo->prepare('DELETE FROM `reports` WHERE `post` = :post'); + $query->bindValue(':post', $post_id); + $query->execute(); + } + /** * Inserts a new report. *