PHPBuilder - CSV to table Simple form :)



RSS Twitter
Snippets Databases

CSV to table Simple form :)

by: Aron Dijkstra
|
December 28, 2004

Version: 1

Type: Full Script

Category: Databases

License: GNU General Public License

Description: With this code u can display a CSV file in a table.



<?php
print("<TABLE border=\"0\" cellspacing\"0\" cellpadding=\"0\" width=70% style=\"font-size: 10pt\">\n");
$row = 0;
$handle = fopen("File.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
   $num = count($data);
   for ($c=0; $c <= $row; $c++)
{
    print("<TR>");
    print("<TD nowrap style=\"border-bottom: 1 solid #800000\">".$data[0]." </td>");
	print("<TD nowrap style=\"border-bottom: 1 solid #800000\">".$data[1]." </td>");
	print("<TD nowrap style=\"border-bottom: 1 solid #800000\">".$data[2]." </td>");
	print("<TD nowrap style=\"border-bottom: 1 solid #800000\">".$data[3]." </td>");
    print("</TR>");
}
}
fclose($handle);
?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Aron Dijkstra

Comment:



Comment:

(Maximum characters: 1200). You have characters left.