My blog script is almost done... but for some reason the actuall blog posts are displayed after ALL other contetnt... why?
here is the section of the script that displays the contents of the blog:
mysql_connect ($dbhost, $dbusername, $dbpassword); //connect
mysql_select_db ($dbname); //select the db
$result = mysql_query("SELECT * FROM $table
WHERE name LIKE '%'
AND date LIKE '%'
AND message LIKE '%'
ORDER BY date DESC
"); //get the messages and names and dates
include($header);
if($author == "1"){
echo "<a href=\"blog2.php?post\">Write a post to the blog</a> -
<a href=\"blog2.php?emptyblog\">Empty entire blog</a>\r\n<br />";
}
if ($row = mysql_fetch_array($result)){
do {
$date = date("F j, Y, g:i:s a", $row["date"]);
$name = $row["name"];
$message = $row["message"];
$message = nl2br($message);
$message = str_replace('[url=', '<a target="_blank" href="', $message);
$message = str_replace('[end]', '">', $message);
$message = str_replace('[/end]', '">', $message);
$message = str_replace('[/url]', '</a>', $message);
$message = strip_tags($message, '<b><a><br><u><i><hr><p><ul><li><ol>');
print "<table width=\"75%\" border=\"0\" bgcolor=\"#E5E5E5\">
<tr>
<td>Name: ".$name."</td>
<td>
<div align=\"right\">".$date."</div>
</td>
</tr>
<tr>
<td colspan=\"2\"><hr />".$message;
if($author == "1"){
echo "<div align=\"right\">
<a href=\"blog2.php?editpost=".$row["date"]."\">Edit post</a> -
<a href=\"blog2.php?deletepost=".$row["date"]."\">Delete Post</a>
</div><hr /></td></tr><br />";
} else {
echo "<hr /></td></tr><br />";
}
} while($row = mysql_fetch_array($result));
} else {
print "Sorry, blog posts are in the blog right now!";
}
include($footer);
mysql_close();