convert an existing Excel file into a .csv format and keep it in one folder. Write the following code in demo.php page.
<?php
if (($handle = fopen("EmpDetails.csv", "r")) !== FALSE) {
echo"<table border=\"1\"cellspacing=\"0\">";
$row = 1;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo"<tr>";
for ($c=0; $c < $num; $c++) {
echo"<td>";
echo$data[$c];
echo"</td>";
}
echo"</tr>";
$row++;
}
echo"</table>";
fclose($handle);
}
?>
No comments:
Post a Comment