Jump to content

Query help please?


Gem

Recommended Posts

Hi guys,

 

Was wondering if someone could help me with a query. Here is my table structure:

commID        int(11)

postID          int(4)

replyto     int(6)

depth     int(2)

timestamp  int(11)

name     varchar(100)

email     varchar(100)

comment     text

 

So what I'm trying to get is the comments in order. The order I need is:

 

comment 1 - parent

comment 2 - parent

comment 5 - reply to comment 2

comment 6 - another reply to comment 2

comment 7 - reply to comment 6 which is a reply to comment 2

comment 3 - parent

comment 4 - reply to comment 3

 

and so on.  There is no limit to how many levels of children there can be per parent.

 

I'm hoping this makes sense :S

 

Can you help?

 

Many thanks

Gem

Link to comment
Share on other sites

I forgot to say, I'm struggling because I need to paginate the comments. I need to page only at a parent, i.e not splitting child comments over seperate pages (planning to use js to show/hide the replies) so I'm wanting like say 5 parent comments, plus all their children per page.  This is why I'm looking for a query to put them in the right order ...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.