I have put a div around the PHP below called box1. What I am trying to do is have a different colored box around every different blog entry. Right now all my entries appear in the same colored box which I dont want. I have tried closing the div after <hr class="hr3" /> because after that a new blog entry begins. When I close the div after h3 the first entry is in the colored box but the other entries are out of place. I have no idea how to do this. Please can someone help!?

The code below is what I currently have on my index page to display my blog entries.

#box1 {
PHP Code:
<div id="box1">

function showinweb($val) {

$val nl2br($val);
//return returns the value and ends execution of function, so any line below it is ignored    

$page = (!isset($_GET['page'])) ? 1$_GET['page'];

// Define the number of results per page
$max_results 3;

// Figure out the limit for the query based
// on the current page number.
$from = (($page $max_results) - $max_results);

// Perform MySQL query on only the current page number's results

$sql "SELECT id,
                DATE_FORMAT(timestamp, '%a.%b.%y') as dateAdded,
        FROM php_blog ORDER BY timestamp DESC LIMIT 
$result mysql_query($sql) or print ("Can't select entries from table php_blog.<br />" $sql "<br />" mysql_error());

$i =1;
$row mysql_fetch_assoc($result)) {

"<p class='blogtitle'> <span class='blogtit'>".showinweb($row['title'])."</span></p><br />";
"<br /><br />".smiley(showinweb($row['entry']));
"<img id='thisimage$i' onmouseover='showdiv(this.id);' onmouseout ='hidediv();' src='entry/blog_images/".showinweb($row['image'])."' alt='' /> ";
"<br />".showinweb($row['dateAdded']);

//count number of comments for this post
$result2 mysql_query ("SELECT id FROM php_blog_comments WHERE entry='".$row['id']."'");
$num_rows mysql_num_rows($result2);
        if (
$num_rows 0) {
//if there's only 1 comment, use singular comment (comment)
if($num_rows == 1){
$word_comment " comment";
//use pluralize comment (comments)
$word_comment " comments";
" <a href=\"entry/journal.php?id=".$row['id']."\">".$num_rows.$word_comment."</a><br />";
else {
"<a href=\"entry/journal.php?id=" showinweb($row['id']) . "\"> Leave a comment</a>"; }
'<br /><hr class="hr3" /><br />';

// Figure out the total number of results in DB:
$total_results mysql_result(mysql_query("SELECT COUNT(*) as Num FROM php_blog"),0);

// Figure out the total number of pages. Always round up using ceil()
$total_pages ceil($total_results $max_results);

// Build Page Number Hyperlinks
// echo "<center>Select a Page<br />";

// Build Previous Link
if($page 1){
$prev = ($page 1);
"<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\">&lt;&lt;Previous</a> ";

$i 1$i <= $total_pages$i++){
$page) == $i){
"$i ";
        } else {
"<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";

// Build Next Link
if($page $total_pages){
$next = ($page 1);
"<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next&gt;&gt;</a>";
// echo "</center>";
How can I seperate blog entries with different colored css boxes?