echoing user comments
I am having trouble with retreiving user comments. here is my code:
if(mysql_fetch_array($sql_result) == 0) {
echo "There are currently no comments to display. Be the first to post one!";
} else {
echo "<table width=\"100% border=2\">";
echo "<tr>";
echo "<td><b>User</b></td>
<td><b>Date/Time</b></td>
<td><b>Comment</b></td>";
echo "</tr>";
while($sql_row=mysql_fetch_array($sql_result))
{
$comment=$sql_row["comment"];
$date=date('D, d M Y H:i:s', $sql_row["time"]);
$user = findUserName($sql_row["user"]);
$imgAvatarSrc = "AVATAR IMAGE SOURCE";
?>
SOME HTML HERE
<br />
<div style="float:right;"><div class="replyBtn"><a href="#btn_comment">Reply</a></div></div>
</div>
</div>
<div id="padding" style="padding:15px;"></div>
<?php
echo "<tr><td><a href='view_profile.php?user=$user' target='_blank' class='noUnderline'><img src='" . $imgAvatarSrc ."' width=65px height=65px/> " . $user . "</a><br></td></tr>";
echo "<tr><td>".$date."</td>";
echo "<td>".$comment."</td>";
}
echo "</tr></table>";
}
if there are no comments related to this image, it shows "be the first to post a comment!" i can post in the else when there is a comment, but then in the while, nothing is printed out. not sure where i am going wrong here... i tried removing the "else" statement, and made the while it's statement, and it worked fine.
