I am trying to add both column headings and alternating color rows to this script...can a php coder please code in an example of both in this script?
Thanks
<?php
$filename = "file.csv";
function viewlog($filename) {
$fp = fopen($filename,"r");
$file = fread($fp,65535);
$replaced = eregi_replace(",", "<td>", $file);
$replaced2 = eregi_replace("\n", "<tr><td>", $replaced);
$replaced3 = eregi_replace("\r", "<tr><td>", $replaced2);
fclose($fp);
return $replaced3;
}
echo "<html><head><title></title></head><body bgcolor=silver>";
echo "<table border=1 bordercolor=black cellspacing=0 cellpadding=5 width=100% style='font-size:10pt'>";
echo viewlog($filename);
echo "</table></body></html>";
exit;
?>