在我网站上张贴一个职位的答复时,我有一席之地。
查询中使用的括号内数字是员额(ID)的数值,这是所观察员额的一系列细节。
如下文所示,产出如下(每个主题都与职位全数挂钩)。
$q = $dbc -> prepare("SELECT * FROM boardposts WHERE parentID = ?");
$q -> execute(array($post[ postID ]));
while ($postReply = $q -> fetch(PDO::FETCH_ASSOC)) {
echo <p><a href="http://www.example.com/boards?topic= . $_GET[ topic ] . &view= . $postReply[ postID ] . "> . $postReply[ subject ] . </a> ;
}
目前的产出大致如下:
Replies To This Message:
subject 1
subject 2
subject 3
subject 4
我也可在名单上列入对答复的答复,内容大致如下:
Replies To This Message:
subject 1
subject 1 reply
subject 1 reply
subject 1 reply reply
subject 2
subject 3
subject 3 reply
subject 3 reply
subject 3 reply reply
subject 4
subject 4 reply
subject 5
subject 6
subject 6 reply
subject 4 reply reply
I understand all the indenting can be with css, but am stuck as to how to pull the data from the mysql database and in the correct order, I tried while loops within while loops, but that involved queries inside while loops, which is bad!
感谢你们的投入!