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>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.