can anyone give me a basic scope of architecture for a database holding comments, in which some reply to others, and then the theory behind the query so that the comments are displayed like:
database structure should be (at bare minimum):
comment_id int
comment_parent_id int (should be default 0 for comments that are the top of a thread)
comment_text text
You'll still need to loop through, but the most efficient way to do this would be to select all the top-level thread IDs first (just the comment_id field), then loop through that result-set and select the comments that are children of that thread (and so on and so forth till you get through all the layers).
Bookmarks