How to Read a CSV file and Print CSV file data in HTML tabular format

<!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>

No comments:

Post a Comment

using avrdude with AVR studio(for windows 10 only)

Requirements 1. arduino-1.6.5-r2-windows.exe 2. as6installer-6.0.1843.exe When I try to configure avrdude in avr studio 6 then wina...