display number of replies to a message (DATABASE QUERY)
Posted: Tue Jun 17, 2003 2:32 pm
Hello,
I am developing a Message Board system in which i want to be able to display the number of replies to a message( similar to this forum)
i have a databse table with the following
postid
title
autor
msg
replyid
How is this value accessed?
Do you run it simulateaneously while selecting the message information e.g. [syntax=php]HAVING message_articles.SELECT *, SUM(REPLYID) FROM message_articles
-> WHERE message_articles.REPLYID = message_articles.POSTID
-> GROUP BY POSTID
-> HAVING message_articles.REPLYID \G[/syntax] (is use this expression to gather the information and then get the number of replies for each meassage) or is it run as a separate query to retirving message information?
Kendall[syntax=php]<?php
?>[/syntax]
I am developing a Message Board system in which i want to be able to display the number of replies to a message( similar to this forum)
i have a databse table with the following
postid
title
autor
msg
replyid
How is this value accessed?
Do you run it simulateaneously while selecting the message information e.g. [syntax=php]HAVING message_articles.SELECT *, SUM(REPLYID) FROM message_articles
-> WHERE message_articles.REPLYID = message_articles.POSTID
-> GROUP BY POSTID
-> HAVING message_articles.REPLYID \G[/syntax] (is use this expression to gather the information and then get the number of replies for each meassage) or is it run as a separate query to retirving message information?
Kendall[syntax=php]<?php
?>[/syntax]