ddellostritto Posted May 16, 2010 Share Posted May 16, 2010 Hi All - I hope that you can help me with a small problem that I have. I need to display a .csv file as a html table. I've found a script that works but it doesn't let me style it: or at least, no unique styling per every other row, bold headers, etc.. Can any one help me? The code I have is: <?php echo "<html>\n<body>\n\t<table style=''>\n\n"; $f = fopen("THECSVFILE.csv", "r"); while (($line = fgetcsv($f)) !== false) { echo "\t\t<tr>\n"; foreach ($line as $cell) { echo "\t\t\t<td style='padding:.4em;'>" . htmlspecialchars($cell) . "</td>"; } echo "\r</tr>\n"; } fclose($f); echo "\n\t</table>\n</body>\n</html>"; ?> Link to comment https://forums.phpfreaks.com/topic/201913-csv-to-html-table-and-styling/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.