我将尝试尽可能简单地解释这一点。任何帮助将不胜感激,因为我不太擅长设计查询。
我有 3 个表:(我已经为这个问题减少了 users 表中不必要的列)
USERS:
id, username, password
PENDINGREVIEW:
id, articleid, requestid, content, writerid, datewritten
ARTICLES:
id, title, length, requestedby, content, writtenby, daterequested, datecompleted
所以说我有review.php
。我希望它显示特定用户表中的review.php
所有文章。pendingreview
所以是这样的:
SELECT * FROM pendingreview WHERE requestid = $userid (where $userid = the id of the user)
我实际上想要显示的review.php
是表格中的文章列表以及articles
表格中有多少文章pendingreview
对应于这些文章中的每一篇。该列表只能由用户请求的文章组成。
所以我想review.php
看起来像这样:
Your "How to build a bike" article request has 3 articles pending review.
Your "How to mow the lawn" article request has 12 articles pending review.
任何有关我将如何做到这一点的帮助将不胜感激!