You also asked a very, very common question, i.e. how to alternate colors
in
table rows... there are a ton of websites/tutorials out there that explain ways to do this.
---John Holmes...
........................................
Apologies for the lengthy code.
I've tried using a few tutorials and am still adrift.
Here's a snippet:
Thank you for any assistance. Tony Ritter ..................
<?
<table width=100% cellpadding=3 cellspacing=1 border=1> <tr> <th bgcolor=\"#497fbf\"><font color=\"#ffffff\">AUTHOR</font> </th> <th bgcolor=\"#497fbf\"><font color=\"#ffffff\">POST</font></th> </tr>";
while ($posts_info = mysql_fetch_array($get_posts_res)) { $post_id = $posts_info['post_id']; $post_text = nl2br(stripslashes($posts_info['post_text'])); $post_create_time = $posts_info['fmt_post_create_time']; $post_owner = stripslashes($posts_info['post_owner']);
$color1 = "#CCFFCC"; $color2 = "#BFD8BC"; $posts_info = 0;
Move the above line outside of your while loop
$row_color = ($posts_info % 2) ? $color1 : $color2;
$row_color = ($posts_info++ % 2) ? $color1 : $color2;
You were setting $posts_info to zero in each loop, so it's never going to change. You must set it to zero outside of the loop, then increment it within.
You could make this real easy and just do:
$row_color = ($row_color == $color1) ? $color2 : $color1;
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php