finalisation de ma part :)

This commit is contained in:
2019-03-06 09:13:31 +01:00
parent 9df001d565
commit cc8ee929f8
13 changed files with 91 additions and 101 deletions

View File

@ -286,7 +286,16 @@ class Post {
*
*/
public static function remove(Post $post) {
Functions::connect()->prepare("DELETE FROM posts WHERE id=:id")->execute(array(":id" => $post->getId()));
$id = $post->getId();
$prepared = Functions::connect()->prepare("DELETE FROM post_tag WHERE post_id=:id");
$prepared->bindValue(":id", $id, PDO::PARAM_INT);
$prepared->execute();
$prepared = Functions::connect()->prepare("DELETE FROM posts WHERE id=:id");
$prepared->bindValue(":id", $id, PDO::PARAM_INT);
$prepared->execute();
}