PHP

DISPLAY CSV AS HTML TABLE IN PHP

Jo Doe,jo@doe.com,465785 Joa Doe,joa@doe.com,123456 Job Doe,job@doe.com,234567 Joe Doe,joe@doe.com,345678 Jog Doe,jog@doe.com,578456

DUMMY CSV FILE

01

PHP READ CSV GENERATE TABLE

02

<table id="demo"><?php   OPEN CSV FILE   $stream = fopen("dummy.csv", "r");

  EXTRACT ROWS & COLS    while (($row = fgets($stream)) !== false) {     echo "<tr>";     $col = explode(",", $row);     foreach ($col as $c)     { echo "<td>$c</td>"; }     echo "</tr>";   }

  CLOSE CSV FILE   fclose($stream); ?></table>