I am wondering what is the best way to implement replies to a parent comment that are stacking infinitely.
Let's say my database looks like this:
Table Columns
comments comment_id | comment
comment_replies comment_id | reply_to | comment
With this database, can I do this:
#1 Comment 1
#2 Reply to #1
#3 Reply to #2
#4 Reply to #3
....
#5 Reply to #3
#6 Reply to #5
....
So far I have managed to do this for up to 1 reply by adding foreach comments.comment_id
where is equal to comment_replies.reply_to
. It works okay for up to 1 reply per a parent comment. Facebook reply system works the same way, but what if I want to add replies to other replies like in the example above?