Ok, im using MySQL. I've been working on a sorta light-weight CMS that lets me post articles and such. users can post comments on the articles, and it logs the date&time of it. but, when it adds a comment, it changes the time that the article was created, when it should only add to the number of comments.
here are my queries:
Code: Select all
// add comment to db
INSERT INTO `comments` ( `id` , `parent` , `author` , `email` , `comment` , `created` )
VALUES (
'', '$id', '$author', '$email', '$comment', NOW( )
);
SELECT * FROM articles WHERE id='$id' // to get the count of comments on this perticuar article
UPDATE articles SET comments='$newcount' WHERE id='$id' // and to update that count.
As you can see, the only UPDATE query affects the comments row, not the row where i keep the date & time. I dont understand why it changes it.
Any idea on why it affects the article?