Hi,
I’m trying to figure out how to store and return nested comments (like reddit)
This is my viewthread php file of my forum where it you can add a comment. I want to be able to create nested comments so you can respond to another comment. Currently you can only add a comment under the thread which appears in date order but you can’t respond to another comment
Here’s my table titled Posts (for comments)
describe Posts;
+---------------+-----------------+------+-----+---------------------+-------------------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-----------------+------+-----+---------------------+-------------------------------+
| id | int(6) unsigned | NO | PRI | NULL | auto_increment |
| User | varchar(30) | NO | | NULL | |
| PostTimeStamp | timestamp | NO | | current_timestamp() | on update current_timestamp() |
| CommentText | varchar(8000) | YES | | NULL | |
| IDOfThread | int(11) | YES | | NULL | |
| Upvotes | int(11) | NO | | 0 | |
| ParentId | int(11) | YES | | NULL | |
+---------------+-----------------+------+-----+---------------------+-------------------------------+
7 rows in set (0.002 sec)
And here’s viewthread php