1级评论&回复系统 - 重复回复问题

时间:2013-06-22 23:37:39

标签: php mysql commenting

我正在尝试创建评论&回复系统非常类似于: PHP commenting system with 1 level reply. Query display issue

我很乐意在那里使用答案,但我很新,我想如果没有在上下文中看到所有代码我就不会理解 - 抱歉!

如果您想随时查看我的代码,请随时提出。 另外要查看我目前所拥有的内容,请访问我的测试网站 @ http://www.stealthgate.co.uk/test/index.php

理想情况下,我想按如下方式显示我的评论和回复:

COMMENT FORM 

COMMENT(#3) from (USERNAME) -- Newest comments displayed first

Reply (#2) to COMMENT(#3) from (USERNAME) -- Newest replies displayed first
Reply (#1) to COMMENT(#3) from (USERNAME) -- Oldest Replies Below

REPLY FORM 


COMMENT(#2) from (USERNAME) -- Older comments displayed later (per loop)

Reply (#3) to COMMENT(#2) from (USERNAME) -- Newest replies displayed first
Reply (#2) to COMMENT(#2) from (USERNAME)
Reply (#1) to COMMENT(#2) from (USERNAME) -- Oldest Replies Below

REPLY FORM 

etc......

我的数据库中有2个表:

1: Comment TABLE
ID - auto incrementing - integar - PRIMARY KEY.
NAME - Populated by the 'name' area of the "comment" form.
COMMENT - Populated by the 'comment' area of the "comment" form.

2: Reply TABLE
REPLYID - auto incrementing - integar - PRIMARY KEY.
COMMENTID - Populated using a variable in a hidden value in the "reply" form.
NAME - Populated by the 'name' area of the "reply" form.
REPLY - Populated by the 'comment' area of the "reply" form.

但不幸的是,在最新评论之后,我不断收到所有评论的重复回复(参阅下面的评论(#2)):

COMMENT FORM 

COMMENT(#3) from (USERNAME) -- Newest comments displayed first

Reply (#2) to COMMENT(#3) from (USERNAME) -- Newest replies displayed first
Reply (#1) to COMMENT(#3) from (USERNAME) -- Oldest Replies Below

REPLY FORM 


COMMENT(#2) from (USERNAME) -- Older comments displayed after (per loop)

Reply (#2) to COMMENT(#3) from (USERNAME) [DUPLICATES FROM ABOVE REPLIES]
Reply (#1) to COMMENT(#3) from (USERNAME) [DUPLICATES FROM ABOVE REPLIES]

Reply (#3) to COMMENT(#2) from (USERNAME) -- Newest replies displayed first
Reply (#2) to COMMENT(#2) from (USERNAME)
Reply (#1) to COMMENT(#2) from (USERNAME) -- Oldest Replies Below

REPLY FORM 

etc......

我知道我在我的评论中循环我的ID特定回复,这导致每个先前回复的回复重复,但我不知道另一种方法。

因此,我如何消除这些重复行为!? 任何建议都会给您带来极大的帮助! 非常感谢你提前! 莱恩

0 个答案:

没有答案