I wasnt sure what to label this so here we go.
I have a table which holds messages sent by users. The first message sent is the parent and then each message after that is a reply. However a reply can have a reply, and a reply to a reply can also have a reply...and so on. The table structure is:
message_id message reply_messages_id
1 abc 0 (this means its the parent)
2 def 1 (reply to message_id 1)
3 ghi 2 (reply to message_id 2)
4 jkl 1 (another reply to message_id 1)
5 mno 3 (reply to message_id 3)
6 pqr 0 (another parent)
7 stu 6 (reply to message_id 6)
The thing I am struggling with is that I am trying to have the output displayed as:
abc
- def
- ghi
- mno
- jkl
pqr
- stu
The other thing is I dont know how many layers deep a reply can go as a user can keep replying to replies.
ANY help is greatly appreciated.