在我的网站中,用户可以更新,其他人可以评论更新,就像其他社交网站一样。
在做什么:
query = fetches first name, last name, user id, update id, update post UNION same details for the user who has logged in i.e /* Updates Of Current Logged In User + Updates Of People He Is Following */
loop {
prints first name last name and update
}
后来我介绍了评论功能,所以现在我在循环中调用查询并再次运行循环以获取评论..
loop {
prints first name last name and update
commentquery = fetches firstname, last name, user id, comment, of the particulat post
again loop {
prints first/last name of the person who commented, and his comment
}
}
现在根据我的说法,我想这可以通过 SQL 查询来完成,当我检索帖子时,我可以获取它的评论,或者这是正确的方法?问题是当外部循环运行时,内部循环也运行以获取适当的评论,所以我可以加入表来检索与帖子/更新相关的评论吗?