I have this script that successfully converts my CSV file to an HTML table, but since I need help working out the format.
If anyone can help me get the table format to
It would be really helpful.
If anyone can help me get the table format to
Code:
<table id="table_id">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>etc</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1 Data 1</td>
<td>Row 1 Data 2</td>
<td>etc</td>
</tr>
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
<td>etc</td>
</tr>
</tbody>
</table>
It would be really helpful.
Code:
<?php
$filename = "CompleteSoftInfo.csv";
function viewlog($filename) {
$fp = fopen($filename,"r");
$file = fread($fp,65535);
$replaced = eregi_replace(",", "<td>", $file);
$replaced2 = eregi_replace("\n", "<tr><td>", $replaced);
$replaced3 = eregi_replace("\r", "<tr><td>", $replaced2);
fclose($fp);
return $replaced3;
}
echo "<body>";
echo "<table id='table_id'>";
echo viewlog($filename);
echo "</table></body>";
exit;
?>