Answer the question
In order to leave comments, you need to log in
Realization of the wall like Vkontakte?
Hello! Can anyone tell me how to implement the output of posts and the last 3 comments to it? Well, how did they do it in VK. You make a request and the output is something like
array (
array ("title" => "Статья","author" => "Автор","comments" => "массив с комментариями")
)
Answer the question
In order to leave comments, you need to log in
What's the problem?
2 requests:
select * from posts where post_id = 123;
select * from comments where post_id = 123;
Q = Number of comments to the id of this post (for example)
Under the post, you display comments with the id of the post and the id of the comment Q, Q-1 and Q-2
No-no) You do not understand) You say if one post. And in my cycle these records are displayed. That is, you need to get the record from the database in such a way that I could make a cycle and make another cycle inside the cycle that displays comments. If you make requests in a cycle, then I think this is not quite good.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question