<?php
//require('classes/ParseCSV.class.php');
//$process_csv = new ParseCSV('andersons_bay_sample.csv');
//$process_csv->processData();
function readCSV($csvFile){
$file_handle = fopen($csvFile, 'r');
while (!feof($file_handle) ) {
$line_of_text[] = fgetcsv($file_handle, 1024);
}
fclose($file_handle);
return $line_of_text;
}
$csvArray = readCSV('andersons_bay_sample.csv');
echo "<table style='border:1px solid black'>";
for($i = 0; $i < count($csvArray); $i++)
{
echo "<tr>";
for($j = 0; $j < count($csvArray[0]); $j++)
{
if($i == 0)
{
if($csvArray[0][$j] == "Date" || $csvArray[0][$j] == "Time")
{
echo "<th style='text-align:left;'></th>";
}
else
{
echo "<th style='text-align:left;'>" . $csvArray[0][$j] . "</th>";
}
}
else
{
if($csvArray[$i][$j] == null)
{
echo "";
}
else
{
echo "<td style='border:1px solid black; padding:6px;'>" . $csvArray[$i][$j] . "</td>";
}
}
}
echo "</tr>";
}
echo "</table>";
?>