PHP一对多的关系

I have to table posts and comments have a relation between them i want to display comments of post I display post but I don't know how to display it's commented PHP native help, please

I would be nice if you provide your table structures and the code you have so far. Without those information it is harder to help. ;)

I assume you store the post_id in your comments table? So after you fetch your post in your php-script you will execute a second query on the comments table having your post_id. Sth. like:

Select * From comments WHERE post_id = $postId 

make sure that your $postId is safe against SQL injections. Fetch the results in an php array and test if it's empty. If the array isn't empty, you can loop through it with foreach and list the comments.

Your question is not clear, but here is a approx answer

describe your table, displaying comments of a single post is quite easy,

SELECT * from comments WHERE post_id = 123

then use php to loop through comments

e.g

foreach($comments as $comment) { 
     ... 
}

OR if you want to get all posts with all comments, here is i created a fiddle for you

http://sqlfiddle.com/#!9/e0264e/1

Help yourself by editing the schema and playing with it