Do you have a fondness for greenbar? Well, here is a report that alternates colors in a similar fashion. Woohoo!! Greenbar!!! See this article for details on the database we are running the report against, and our other articles on HTML/PHP. A book we like that really helped us is Web Database Applications with PHP & MySQL. OK. Code first:
<html> <head> <title>SystemsDoc</title> </head> <body bgcolor="white"> <?php require_once("config.php"); $db1=mysql_connect($dbhost, $dbuname, $dbpass); mysql_select_db("sysops"); $query="SELECT UID, deploy_date,machname,phone,assetnum,manu,model,sysversion FROM systemsdoc ORDER BY manu"; $result = mysql_query($query); echo "<a href=\"index.html\">Click here</a> to return to SysOps"; echo "<table border=\"0\">"; $j=true; while ($row = mysql_fetch_row($result)) { if($j) $j=false; else $j=true; echo "<tr>"; for ($i=0;$i<mysql_num_fields($result);$i++){ if ($j){ echo "<td bgcolor=\"#CCFF99\">"; } if (!$j){ echo "<td bgcolor=\"#FFFFCC\">"; } echo $row[$i]; echo "</td>"; } } echo "</table>"; mysql_close($db1); ?> </body> </html> |
Here is what this looks like:
Mmmmmmm… greenbar goodness. I think I might die from pleasure.