rendered paste body<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 Begining of Html. echo "<html>\n"; echo "<head>\n<head>\n\n"; echo "<body>\n"; 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 some Variables$cols = array();$class=(($n % 2) == 0) ? 'white' : 'green';//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)){ echo '<tr>'; foreach ( $cols as $fieldname ) { echo '<td>'. $row[$fieldname] ."</td>\n"; //echo '<td class="' . $class . '">' . $row[$fieldname] . "</td>\n"; } echo '</tr>';}?>