<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
$CSVfp = fopen("fruits.csv", "r");
$data;
if($CSVfp !== FALSE) {
while(! feof($CSVfp)) {
$data = fgetcsv($CSVfp, 1000, ",");
print_r($data);
}
}
if($CSVfp!==FALSE){
$CSVfp = fopen("fruits.csv", "r");
echo "<table border='2'>";
while(!feof($CSVfp)){
$data = fgetcsv($CSVfp,1000 , ",");
$count= count($data); // number of colummns present in a each row
//echo "<tr><td>count=".$count."</tr>";
echo "<tr>";
for($i=0;$i<$count;$i++)
{
echo "<td>".$data[$i];
}
echo "</tr>";
}
echo "</table>";
}
fclose($CSVfp);
?>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
$CSVfp = fopen("fruits.csv", "r");
$data;
if($CSVfp !== FALSE) {
while(! feof($CSVfp)) {
$data = fgetcsv($CSVfp, 1000, ",");
print_r($data);
}
}
if($CSVfp!==FALSE){
$CSVfp = fopen("fruits.csv", "r");
echo "<table border='2'>";
while(!feof($CSVfp)){
$data = fgetcsv($CSVfp,1000 , ",");
$count= count($data); // number of colummns present in a each row
//echo "<tr><td>count=".$count."</tr>";
echo "<tr>";
for($i=0;$i<$count;$i++)
{
echo "<td>".$data[$i];
}
echo "</tr>";
}
echo "</table>";
}
fclose($CSVfp);
?>
</body>
</html>