I'd like to take a CSV file living server-side and display it dynamically as an html table. E.g., this:
Name, Age, Sex "Cantor, Georg", 163, M
should become this:
Name Age Sex Cantor, Georg 163 M
Solutions in any language are welcome.
asked Feb 6, 2009 at 1:44
26.8k 45 45 gold badges 155 155 silver badges 233 233 bronze badges
The previously linked solution is a horrible piece of code; nearly every line contains a bug. Use fgetcsv instead:
\n\n"; $f = fopen("so-csv.csv", "r"); while (($line = fgetcsv($f)) !== false) < echo ""; foreach ($line as $cell) < echo "" . htmlspecialchars($cell) . " "; > echo " \n"; > fclose($f); echo "\n