PHP comment reply solution

Source: Internet
Author: User
PHP commented and replied to this post. at last, it was edited by haoren026 from 2013-12-1521: 12: 03. I know this question is very basic .. I also searched a lot of posts, but it was quite troublesome, or I was not able to achieve it. The problem is: I am practicing writing a blog post and replying to a PHP comment.
This post was last edited by haoren026 at 21:12:03, January 15 ,. I know this question is very, very elementary .. I also searched a lot of posts, but it was quite troublesome, or I was not able to achieve it.

The problem is as follows:
I am practicing writing a blog system. to implement the comment reply function, the requirements are not high. The visitor comment and the blogger replies to the comment. there is only one layer of relationship: Comment-reply. That's simple.

The data table structure of the online method is mostly as follows:
Id: comment id
Pid: the id of the reply comment.
Content: comment content

I want to know how to find the reply record when the record of the comment is separated from the record of the reply, for example:

Id pid
1 0
2 0
3 1 // The reply is separated from the comment by several lines
4 0

This problem is hard to solve in SQL sorting and reorganization .. Thank you!

Share: More

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.