Hi Dan, > Hello all, > > I'm in the midst of creating an internet speed test system thingamabob for > my website. It's basically finished...but ugly as sin. What I'd like to do > is have the results (an average of each domain tested) listed in a nice > pretty table with alternating background colors, kinda like a ledger. How > on earth do I do this? > > Here's what I've got thus far: > > <?php > echo "Average speeds of each domain tested:<br>"; > $mongo = @mysql_query ("SELECT > substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY > substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC"); > echo "<table><tr><td>Domain</td><td>Average Speed</td></tr>\n"; > while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo > "<tr><td>$mongorow[0]</td><td>$mongorow[1]</td></tr>\n";} > echo "</table>"; > ?> You must use a counter in while. Let's change your code like: $counter = 0; while(....){ // here actually is your while where I add this lines $counter++; $counter%=2; if($counter) $bgcolor="red"; else $bgcolor="green"; // change in echo command: echo "<tr bgcolor=$bgcolor>...." } // I just hope u don't use red and green through :) > > And I'd like it to spit out something along these lines: > <table> > <tr bgcolor=#dddddd><td>domain1.com</td><td>666.6 kbps</td></tr> > <tr bgcolor=#ffffff><td>domain2.com</td><td>3000.0 kbps</td></tr> > repeat until done > </table> > > The gizmo is up and running at > http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a > gander. > Thanks a bunch, > Dan > > ---------------------------------------------------------------------------- ---- > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php