Code: Select all
Parent (parent_id = 0, id = 1)
-- Child (parent_id = 1, id = 3)
------ Child (parent_id = 3, id = 4)
-- Child (parent_id = 1, id = 6)
------ Child (parent_id = 6, id = 8)
---------- Child (parent_id = 8, id = 2)
Parent (parent_id = 0, id = 5)
Parent (parent_id = 0, id = 11)
Parent (parent_id = 0, id = 15)
-- Child
Values are in a database. Fields:
Code: Select all
id | parent_id | content | nameid = auto_inc number
parent_id = what id is the root of this comment. If 0, it is a parent. If > 0 it ties it to the parent comment. In the above example, the ID's were numbers I just pulled out of my hat. I did that to show that the childs parent_id = the parents id
content = what is in the thread
name = who made the comment
I have tried a few things with no success. Styling it is easy, but getting the messages to display in the right order is the hard part. Why? Because anyone can reply to any thread at any time thus the database cannot be queried and directly outputted. Chances are arrays need to be created to handle this stuff, but I don't have ideas on how to implement this.
Any help would be greatly appreciated.