I have a comment system derrived from the comment systems made by some users here on this forum and I wanted to add a little bit to it. I want to make it so each comment is numbered. So when a comment is displayed it will look like this:
#1
<comment>
<posted by>
#2
<comment>
<posted by>
I’m not sure how to get it to number each comment in PHP. I have the comment code on lots of pages so the numbering would have to be unique to each page.
the PHP for displaying comments is as follows:
$result2 = $connector->query('SELECT * FROM reviewcomments WHERE comment_on = '.$HTTP_GET_VARS['id']);
while($comment = mysql_fetch_array($result2)) {
$comment['comment'] = htmlspecialchars($comment['comment']);
echo $comment['comment'];
echo "<div class='signature'><i><br><img src='http://www.razerPosted by <a href='../users/profile.php?username=".$comment['postedby']."'>".$comment['postedby']."</a>";
echo ' at ';
echo $comment['date'];
echo '<br><hr width="100" align="left"><p></i></div>';
}
htmlspecialchars is just part of the class Nokrev wrote to strip away special characters and HTML.
my database structure looks like this:
As you can see it has a field for comment_on which keeps track of which page the comment was made on, a field for comment which keeps the comment, postedby which records the username of the postee, date for the date of the comment, and IP to record the users IP.
Any help is appreciated as always.