I've developed a PHP-code that takes in user's comments and stores them in DB. But I wanted to output the user's image also when he posts a comment. Also, if there is no image for the user in the DB, then a default image should be shown. Currently my PHP code looks like:
<?php
if($pid && $sess_uid && $comment_text){
$sql = "INSERT INTO ttl_comments (comment_pid, comment_text, comment_uid) VALUES ('".$pid."', '".$comment_text."', '".$sess_uid."')";
$result = mysql_query($sql);
$comment_id = mysql_insert_id();
if($comment_id > 0)
echo '<div class="usercomment">
<div class="clr"></div>
<a href="profile.php?uid='.$sess_uid.'"></a>
<a href="profile.php?uid='.$sess_uid.'">
<span class="commentsuser">'.$sess_fname." ".$sess_lname.'</span>
</a>
<span class="comments">'.$comment_text.'</span>
</div>
}
?>