Hey all,

So here's the deal. I have a list of comments, and each comment gets an automatically generated commentid when it gets added to my mysql table. I just added the functionality to allow users to reply to other ppl's comments ... So I added another field to my table called replytoid. This field holds the commentid number of the comment being replied to.

When someone views a blog, I want it to display all the associated comments in ASC order. If a comment is actually a reply to another comment, it should show up directly under it (despite the commentid number).

I normally use ORDER by or Group by in my mysql queries to organize data for output. The pages are in php.

$cmtqry="select * from ".BLOG_COMMENTS." where eparent='".$HTTP_GET_VARS['blogid']."' order by commentid, replytoid";
                if($cmtrows > 0){

But this doesn't seem to work correctly. I also used the conjunction of the group by and order by... that didn't work either.

Is there another way to do this?? Any help would be appreciated!

11 Years
Discussion Span
Last Post by jbennet

i did it using a variable in a loop


} Do
display $recordnum
$recordnum ++
{ Loop until recordnum = last in database
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.