How does php cyclically output comments and reply to the mysql table structure? current table: comment and reply to comment table + ------ + ---- + --------- + -------- + | id | uid | content | pid | + ------ + ---- + --------- + -------- + | 1 | AA | XXXXX | NULL | this is the first comment | 2 | how does B php cyclically output comments and reply to mysql table structure?
Current table:
Comment and reply comment form
+ ------ + ---- + --------- + -------- +
| Id | uid | content | pid |
+ ------ + ---- + --------- + -------- +
| 1 | AA | XXXXX | NULL | // This is the first comment
| 2 | BB | AAAAAAA | 1 | // This is the first comment
| 3 | CC | BBBB | 2 | // reply to the first reply
| 4 | DD | ddddddd | 3 // reply to the second reply
| 5 | DD | ddddddd | 3 |
+ ------ + ---- + --------- + -------- +
How can this be cyclically output in the program?
------ Solution --------------------
Like QQ space?
There are two for loops.
Add JS @ who and who when replying.