\n";
echo "
\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 Names
while ($row_n= mysql_fetch_assoc($f_names))
{
$cols[] = $row_n['Field'];
echo '| '. $row_n['Field'] ." | \n";
}
$result = mysql_query("SELECT * FROM $table ORDER BY $id");
while($row = mysql_fetch_assoc($result))
{
$class=(($n % 2) == 0) ? 'white' : 'green';
echo '
';
foreach ( $cols as $fieldname ) {
//check to see if $fieldname is null
if (empty($fieldname)) $fieldname= "|   | ";
echo '' . $row[$fieldname] . " | \n";
}
echo '
';
$n++;
}
?>