这段代码我看了很久,没看到知道问题出在哪里。。
function getComment($topic_id){
$sql = "SELECT * FROM comment WHERE topic_id='$topic_id' ORDER BY time DESC LIMIT 20";
$result = mysql_query($sql);
//the "id of the comment willl be used in maing the like box"
while($output = mysql_fetch_assoc($result)){
$qry = "SELECT username, avatar2 FROM user WHERE user_id='".$output['user_id']."'";
$rst = mysql_query($qry);
$out = mysql_fetch_assoc($rst);
$disp = '
<div class="tmain">
<h3 class="underlinebold">Topic Title<span class="not_left">
<ul>
<li><i class="icon-time" style="margin-top:5px;"></i>time: '. getTime($output["time"]) .' ago</li>
<li><i class="icon-pencil" style="margin-top:5px;"></i>Edit</li>
<li><span class="badge badge-inverse">#2</span></li>
</ul>
</span></h3>
<div class="postWrap">
<div class="userInfo">
<ul>
<li><img src="'. $out["avatar2"] .'" /></li>
<li>'. $out["username"] .'</li>
<li>'. commentNo($output["user_id"]) .'</li>
</ul>
</div>
<div class="comment">
<div class="commentText">'.
$output["content"].'</div>
<ul class="below">
<li><i class="icon-flag" style="margin-top:3px;"> </i>Report</li>
<li><i class="icon-edit" style="margin-top:3px;"> </i>Quote</li>
<li><i class="icon-thumbs-down" style="margin-top:3px;"> </i>Mtcheew...(<span>0</span>)</li>
<li><i class="icon-thumbs-up" style="margin-top:3px;"> </i>Correct!(<span>0</span>)</li>
</ul>
</div>
</div>
</div>
';
return $disp;
}
}
该代码假设获取与特定主题相关的所有评论并将它们显示在主题页面上..但它只显示最后发布的代码而没有其他内容..我不知道我在哪里弄错了..
你可以在这里看到效果测试论坛所以请如果你们能帮忙...