<style> td.green { background-color:#c7eca9; } td.white { background-color:#fff; } </style><?php//Connect to mysql.include ('connection_db.php');//This is the table to fetch from.$table = 'ATM';//Will be used to sort the rows.$id= 'Server_Name';//create table. echo "<table border=1>\n"; echo "<tr>\n"; //Perform a query for rows and to populate$f_names = mysql_query("SHOW COLUMNS FROM $table ");//create a variable wfor columns.$cols = array();//Fetch Query Results and Spit out Row Nameswhile ($row_n= mysql_fetch_assoc($f_names)){$cols[] = $row_n['Field']; echo '<th>'. $row_n['Field'] ."</th>\n";}$result = mysql_query("SELECT * FROM $table ORDER BY $id");while($row = mysql_fetch_assoc($result)){$class=(($n % 2) == 0) ? 'white' : 'green'; echo '<tr>'; foreach ( $cols as $fieldname ) {//check to see if $fieldname is nullif (empty($fieldname)) $fieldname= "<td> </td>"; echo '<td class="' . $class . '">' . $row[$fieldname] . "</td>\n"; } echo '</tr>';$n++;}?>