Scalable Solution For Threaded Comments?

I'm sure you'll find the article Managing Hierarchical Data in MySQL helpful. Those two tables can be easily merged into one.

Up vote 0 down vote favorite 2 share g+ share fb share tw.

I'm not sure how to create a threaded comments system in PHP and MySQL which can handle hundreds of comments at a time. Something like this is the only thing I can come up with $query = execute_query...('SELECT * FROM `comments` WHERE `post` = "1"'); foreach($query as $comment){ $replies = execute_query...('SELECT * FROM `comment_replies` WHERE `comment` = "' . $comment'id' .

'"'); if($replies){ echo $comment'body'; //.... foreach($replies as $reply){ /*....*/ } } else{ echo $comment'body'; } } So I need tips on database structure and how I can retrive the all the threaded comments with performance in mind please :) php mysql threaded-comments link|improve this question edited Jan 27 '10 at 20:10 asked Jan 27 '10 at 20:00Ben Shelock2,49521457 84% accept rate.

1: Fantastic resource. – James Jan 27 '10 at 22:22.

Then just add a extra generated field that shows if its a comment or a comment_reply. And select them with a if in a foreach like: if($type == 'comment') { //do something with the comment } elseif($type == 'comment_reply') { //do something with the comment reply } Also check if the comment id changes so you can seperate them.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions