Hosting your own web site - WRITE YOUR OWN BLOG ENGINE if($mycomments) { echo
WRITE YOUR OWN BLOG ENGINE if($mycomments) { echo “
- “; do { $comment_id = $mycomments[”comment_id”]; $name = $mycomments[”name”]; $website = $mycomments[”website”]; $comment = format($mycomments[”comment”]); if ($website != “”) { echo “
- $name wrote:
- $name wrote:
- $comment
\n”; } else { echo “
\n”; } echo “
\n”; } while ($mycomments = mysql_fetch_array($result3)); echo “
“; } else { echo “
There are no comments yet.
“; } ?>
This code should be quite familiar to you by now. First, it checks that some comments have been found in the database and then uses a do-while loop to display them on the screen, adding a link to the commenter s name if one was supplied. Notice also that I am using the format function to format the comment. Figure 7-17 shows what your post page should like after a comment has been added. Figure 7-17. Post page with a comment added 317