S A N T A Posted April 25, 2008 Share Posted April 25, 2008 well for some reason when i load the page it says there is 1 comment but it wont display the comment? heres the code: <?php require("header.php"); $sql = "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1;"; ?> <div id="main"> <?php $result = mysql_query($sql)or die(mysql_error()); $row = mysql_fetch_assoc($result); echo "<h2><a href='viewentry.php?id=" . $row['id'] . "'>" . $row['subject'] . "</a></h2><br />"; echo "<i>In <a href= viewcat.php?id=" . $row['cat_id'] ."'>" . $row['cat'] . "</a> - Posted on " . date("D jS F Y g.iA", strtotime($row['dateposted'])) . "</i>"; echo "<p>"; echo nl2br($row['body']); echo "</p>"; echo "<p>"; $commsql = "SELECT name FROM comments WHERE blog_id = " . $row['id'] . " ORDER BY dateposted;"; $commresult = mysql_query($commsql)or die(mysql_error()); $numrows_comm = mysql_num_rows($commresult); if($numrows_comm == 0) { echo "<p>No comments.</p>"; } else { echo "(<strong>" . $numrows_comm . "</strong>) comments : "; $i = 1; while($comrow = mysql_fetch_assoc($commresult)) { echo "<a href='viewentry.php?id=" . $row['id'] ."#comment" . $i . "'>" . $commrow['name'] . "</a> "; $i++; } } ?> </div> <div id="bar"> <?php echo "</p>"; echo "Previous Entries:"; $prevsql = "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1, 5;"; $prevresult = mysql_query($prevsql); $numrows_prev = mysql_num_rows($prevresult); if($numrows_prev == 0) { echo "<p>No previous entries.</p>"; } else { echo "<ul>"; while($prevrow = mysql_fetch_assoc($prevresult)) { echo "<li><a href='viewentry.php?id=" . $prevrow['id'] . "'>" . $prevrow ['subject'] . "</a></li>"; } } echo "</ul>"; ?> <?php require("footer.php"); ?> help appreciated Link to comment https://forums.phpfreaks.com/topic/102825-web-blog-problem-with-commenting/ Share on other sites More sharing options...
DarkWater Posted April 25, 2008 Share Posted April 25, 2008 Did you not post the same thread a while ago? Link to comment https://forums.phpfreaks.com/topic/102825-web-blog-problem-with-commenting/#findComment-526711 Share on other sites More sharing options...
S A N T A Posted April 25, 2008 Author Share Posted April 25, 2008 that was another problem o and about this problem i cut the code down to the part i need help with: echo "<p>"; $commsql = "SELECT name FROM comments WHERE blog_id = " . $row['id'] . " ORDER BY dateposted;"; $commresult = mysql_query($commsql)or die(mysql_error()); $numrows_comm = mysql_num_rows($commresult); if($numrows_comm == 0) { echo "<p>No comments.</p>"; } else { echo "(<strong>" . $numrows_comm . "</strong>) comments : "; $i = 1; while($comrow = mysql_fetch_assoc($commresult)) { echo "<a href='viewentry.php?id=" . $row['id'] ."#comment" . $i . "'>" . $commrow['name'] . "</a> "; $i++; } } ?> Link to comment https://forums.phpfreaks.com/topic/102825-web-blog-problem-with-commenting/#findComment-526716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.