I want to show this CSV File the same way as the picture but then in PHP. Right now I know how to show it if they were all under "A", but I'm stuck now on how to show it with more then one cell.
<?php
echo "<table border='1'>";
if (($handle = fopen("top10.csv", "r")) !== FALSE) {
$data = fgetcsv($handle, 0, ",");
while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
echo "<tr>";
$num = count($data);
for ($i=0; $i < $num; $i++) {
echo"<td>" . $data[$i] . "<br /> </td>";
}
echo "</tr>";
}
fclose($handle);
}
?>
This is how I did it with 2 rows.
Image:
Result right now:
You might want to use
SplFileObject
which can parseCSV
files. For example:PHP Documentation