I'm having some trouble with my website. It uses HTML with embedded PHP. I have a schedule page that pulls information from a CSV file and displays it as a table on the site, to make it easier to update schedules, but it's not working for some reason. Here's the code (I cut out the unimportant stuff).
<html>
<head>
</head>
<body>
<table>
<?php
$f = fopen("schedule.csv", "r");
while (($line = fgetcsv($f)) !== false)
{
$row = $line[0]; // We need to get the actual row (it is the first element in a 1-element array)
$cells = explode(";",$row);
echo "<tr>";
foreach ($cells as $cell)
{
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>
";
}
fclose($f);
?>
</table>
</body>
</html>
However, when I try opening the webpage, all I get is:
foreach ($cells as $cell) { echo ""; } echo "
"; } fclose($f); ?>
" . htmlspecialchars($cell) . "
I can't tell if I'm missing a punctuation or what. I basically copied it from another site that another programmer recommended to someone else, so I don't know what's wrong.