count the number of comments (php/mysql) -


i using code can count number of comments each article

select *, count(comment_id) count article_comments article_id =colname group article_id 

this comment table like

http://i54.tinypic.com/2cdu3dk.png

i want save these number in table (the articles table.. each number next it's article ) this

http://i54.tinypic.com/2dgm82u.png

and when user enter comment..the number change automatically

someone me code or if there way

i know it's long question have been trying solve like..forever

thanx

you set trigger updates comment count table every time comment added. or add update query right after insert query in comment page.


Comments