If I change if($comments_count == 0) to if($comments_count == 1), it echoes out the text (if there is 1 comment). But revert back to == 0, the command doesn't get executed. I tried echoing out the value of $comments_count on a page that doesn't have a comment and it says 0. But the if-else ignores it and doesn't print out anything.
This is the code:
$query = "SELECT * FROM comments WHERE id = {$set_id}";
$all_comments_set = mysql_query($query);
$comments_count = mysql_num_rows($all_comments_set);
while($comment = mysql_fetch_array($all_comments_set)) {
if($comments_count == 0) {
echo $comments_count;
echo "<div class='comments'><p>There are no comments to show right now. Be the first to comment!</p></div>";
} else {
echo $comments_count;
echo "<div class='comments'>
<p class='commenter'><a href=''>".$comment['commentAuthor']."</a></p>
<p>".$comment['comment']."</p>
</div>";
}
}
whileloop if you already know you have no comments?