我通过论坛搜索,但无法得到权威的答案.我想以这样的方式实现嵌套的注释结构:
- This is the parent first comment!
- This is the reply for the first parent comment!
- This is a reply for the first reply of the parent comment!
- This is a third reply for the first parent comment!
- This is another reply for first parent comment!
- This is the reply for the first parent comment!
- This is gonna be parent second comment!
- This is a reply for the second comment!
- This is fourth parent comment!
我桌子的转储如下:
+----+------------------------------------------------------------+--------+
| id | text | parent |
+----+------------------------------------------------------------+--------+
| 1 | This is the parent first comment! | 0 |
| 2 | This is gonna be parent second comment! | 0 |
| 3 | This is the reply for the first parent comment! | 1 |
| 4 | This is another reply for first parent comment! | 1 |
| 5 | This is a reply for the first reply of the parent comment! | 3 |
| 6 | This is a reply for the second comment! | 2 |
| 7 | This is a third reply for the first parent comment! | 3 |
| 8 | This is fourth parent comment! | 0 |
+----+------------------------------------------------------------+--------+
我知道如何使用mysql_query()和while()循环. PHP和PHP的初学者MySQL的.请帮帮我.