What I want is when I remove an article, it should remove the comments and profile.comments-1 for each comment.
here's what I have so far:
Code: Select all
public function removeArticleComments($articleid)
{
$sql = "UPDATE comments AS c
LEFT JOIN profiles AS p ON c.author = p.id
SET p.comments=p.comments-1 WHERE c.articleid=%d";
$vars = array($articleid);
$result = dbConnect::query($sql,$vars);
echo mysql_info();
$sql = "DELETE FROM comments WHERE articleid=%d";
$vars = array($articleid);
$result = dbConnect::query($sql,$vars);
}
I hope that you understand it and can give me a way of doing it
Thanks