Thanks for the response. I too have been a programmer for about years. (sorry, I couldn't resist ;)
I forgot all about testing my approach on PHP, so I went ahead and gave it a shot today. I don't remember what I posted in my pseudocode, but I only encountered a minor syntax error when I wrote it off the top of my head. I'm not sure what problems you saw earler, but here's what I came up with today (it works on my WinNT development box): <html> <body bgcolor="#FFFFFF"> <table border="1"> <? $col = array("#FFFFFF","#EEFFEE"); for ($i=0; $i<10; $i++) { %> <tr bgcolor="<?=$col[$i % 2 ]%>"> <td>row <?=$i%>, cell 1</td> <td>row <?=$i%>, cell 2</td> <td>row <?=$i%>, cell 3</td> </tr> <? } %> </table> </body> </html> This prints out a table that's 3 colums wide and 10 rows high, with each row alternating colors between green and white. There are a couple of reasons I offered this approach: 1. Speed. It doesnt repeatedly use a function inside the loop to determine the current color. I would think this would be desireable. I'm betting/guessing that calling a function then comparing it to a value then sticking it in an array is slower than accessing an element of an array using %. 2. Flexibility. If you need more than 2 colors, you just expand the array and change the modulus number from 2 to however many colors you want. I'm still fairly new to all things *nix, so my handling of regular expressions is simply not what it should be. When I look at the ereg() you've got... I'm scratching my head. (but I *think* I know what you're doing). TIM -Depression is merely anger without enthusiasm. > -----Original Message----- > From: Vins [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 03, 2001 3:27 PM > To: [EMAIL PROTECTED] > Subject: TO TIM FOSTER - REGARDING THE ALTERNATING ROWS PULLED FROM > TABLES > > > Hi Tim. > I'm a programerr in PHP4 for about years now and just by looking at your > script i can tell it wont work ! > > First of all, if would be dificult for a begginer developer to implement in > their script. > For more advanced developers it will be a great challenge for them to try to > get ti to work ! > > I've created my own little Row Alternator for pulling rows from a table. > > if(ereg("1$|3$|5$|7$|9$", $i)) { > $bg[$i] = "#336666"; > } else { > $bg[$i] = "#339966"; > } > > Place this script snipet in the function where you have detected if there is > actually a result and then just call the bg like this > > echo "<TD BGCOLOR=\"".$bg[$i]."\">\n"; > > This sould help alot more. > Please dont think that I'm hammering your scripting skills. > I'm not. > Just a thought. > > Regards > Vins. > [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]