该评论仅出现在最后一条帖子之后


the comment appears only after the last post

我制作了一个评论页面供用户发布,其他人可以对他们发布的内容进行评论。它运行得很好,但有一个问题我认为它很容易,但我无法获得,当用户在帖子"一"上发表评论时,它通常会出现,但当有3或5等时,评论不会像不在那里一样出现,所以最后我可以非常清楚地表明,最后一条帖子的评论出现了,但如果顶部有任何其他评论。它不会出现

这是我的代码

<?php
    >               
    >       $getBlogs = "select * from blogs where active = 1";
    >       $blogResults = $db -> query ($getBlogs) or die ($db->error);        if
    > ($blogResults) {
    >                       while ($blog = $blogResults -> fetch_object()) {
    >               
    >               ?>
    >               
    >                 
    >                 
    >                 <table width="600" border="0" cellpadding="0"
    > cellspacing="0">
    >                   <tr class="bons">
    >                     <td width="62" align="right" valign="middle"
    > class="blogIBg"><img src="images/blog.png" width="37" height="30"
    > /></td>
    >                     <td width="243" height="28" class="blogSBg"><?php
    > echo $blog->Btitle; ?></td>
    >                     <td width="78" height="28" class="blogSBg"><span
    > class="by11">Posted by :</span></td>
    >                     <td width="117" height="28" class="blogSBg"><span
    > class="blogby12Bg"><span class="red"><b><?php echo $blog->ByName;
    > ?></b></span></span></td>
    >                     <td width="100" class="blogSBg"><span
    > class="by11"><?php echo $blog->dateAdded ?></span></td>
    >                   </tr>
    >                   <tr>
    >                     <td>&nbsp;</td>
    >                     <td colspan="4" class="blogBBg"><?php echo
    > $blog->Bdescription; ?></td>
    >                   </tr>
    >                   <tr>
    >                     <td>&nbsp;</td>
    >                     <td colspan="4" align="right" bgcolor="#D5F1FF"
    > class="blogby11Bg"><a class='example7'
    > href="includes/postComments.php?id=<?php $gotIT=$blog->id; echo
    > $gotIT; ?>">Comment</a></td>
    >                   </tr>
    >                 </table>
    >                 <br />               
    >                    <?php
    >               
    >               }           }
    >                       $comments = "select * from blogscomments where blogestID =
    > $gotIT";          $resultComments = $db -> query ($comments) or die
    > ($db->error);
    >                       if ($resultComments) {
    >               
    >               
    >                   while ($dig = $resultComments -> fetch_object()) {
    >                        ?>
    >                       
    >                           <table width="500" border="0">
    >                               <tr>
    >                                 <td width="32">&nbsp;</td>
    >                                 <td width="197"><?php echo
    > $dig->comments; ?></td>
    >                               </tr>
    >                             </table>
    >                             
    >                             
    >                       <?php
    >                       
    >                       }
    >               
    >               } ?>
    > 
    > </div>

我已经输入了整个代码来给出一个完整的想法,

而代码负责的注释就是这样出现的。

$comments = "select * from blogscomments where blogestID =
 $gotIT";             $resultComments = $db -> query ($comments) or die
 ($db->error);
                      if ($resultComments) {

                   while ($dig = $resultComments -> fetch_object()) {
                        ?>
                          <table width="500" border="0">
                              <tr>
                                <td width="32">&nbsp;</td>
                               <td width="197"><?php echo
 $dig->comments; ?></td>
                               </tr>
                             </table>

                       <?php
                       }
               } ?>

感谢大家,我刚刚得到了它,它很容易,就像我自己做了一个单独的php文件,名为handlingComments.php,我把这个代码作为

<?php
$comments = "select * from blogscomments where blogestID = $gotIT";
            $resultComments = $db -> query ($comments) or die ($db->error);
            if ($resultComments) {

                    while ($dig = $resultComments -> fetch_object()) {
     ?>               
                    <table width="500" border="0">
                              <tr>
                                <td width="32">&nbsp;</td>
                                <td width="197"><?php echo $dig->comments; ?></td>
                              </tr>
                            </table>

                        <?php
                        }
                }
?> 

然后我加入了博客主页,它现在运行得很好。

再次感谢大家,