the comment appears only after the last post
I made a comment page for the users to post and other people can comment on they posts it runs very good but there's one problem I think it's easy but I can't get it, when the user comment on post 'one' it appear normally but when there is 3 or 5 etc. the comment one doesn't appear like it's not there so in the end I can make it very clear that the last post comments appears but if there is any other comments on the top of it. it doesn't appear
this is my code
<?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> </td>
> <td colspan="4" class="blogBBg"><?php echo
> $blog->Bdescription; ?></td>
> </tr>
> <tr>
> <td> &l开发者_开发技巧t;/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"> </td>
> <td width="197"><?php echo
> $dig->comments; ?></td>
> </tr>
> </table>
>
>
> <?php
>
> }
>
> } ?>
>
> </div>
I have type the whole code to give a full idea,
and the code is responsible for the comments to appear is this.
$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"> </td>
<td width="197"><?php echo
$dig->comments; ?></td>
</tr>
</table>
<?php
}
} ?>
Thanks for everybody I just got it and it was very easy like I side I made the separate php file called handlingComments.php and I put this code as will
<?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"> </td>
<td width="197"><?php echo $dig->comments; ?></td>
</tr>
</table>
<?php
}
}
?>
and then I included in the main blog page and it's running very good now.
Thanks again everybody,
精彩评论