Hello all again,
I really need help with some code here (just like everyone else that needs help). I need some code that will make my following code alternate the row color. Like if the first row is black, I want the next row to be white, and then the next be black again and so on.
My situation right now is that I am calling from the MySQL database which will call out for links to posts for a message board. Anyways, I have each link in its own cell and I need to alternate the bgcolor of every cell.
Here is my code.
//Start of code//
while($posts=mysql_fetch_array($result))
{
//$count++ is for Next/Prev links
$count++;
//This too (if statement) is for Next/Prev links
if($count>=$start_rec && $count<=$end_rec)
{
//Real beginning of the output here print "<tr>
<td><a href=\"read.php?PostID=$posts[ID]\">$posts[post_name]</a></td>
</tr>";
}
}
print "</table>";
print "<p><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" valign=\"bottom\">
<tr>
<td>
<div align=\"left\"><a href=\"read?TopicID=$TopicID&page=$prev_page\">Prev</a></div>
</td>
<td>
<div align=\"right\"><a href=\"read?TopicID=$TopicID&page=$next_page\">Next</a></div>
</td>
</tr>
</table>";
}
else
print "<font size=\"2\">There are no Posts for this topic.</font>";
mysql_close($link);
}
//End of Code//
Of course I left out a lot of code, but that code has really nothing to do with this part, all the other code is for other MySQL callings and the Next/Prev links.