title: Reading data from text file and displaying it in a table using PHP
body: <p>I have text files that I would like to read into a website and then display. I use </p>
  
  <pre><code>$sListText = file_get_contents("result - 0001.txt");
  echo nl2br($sListText);
  </code></pre>
  
  <p>which loads it fine with line breaks. I just have no clue how to turn the table data into a table with php.</p>
  
  <p>The text file looks like this:</p>
  
  <pre><code>Prestige Byeenkoms 2014 Dal Josafat Stadion,    10/02/2014
  
  Item: 1 (Dogters - 14) Spiesgooi 500 gm
  
  Pos Naam    Van Span    Uitslag Punt    ASA Rek
  1   Marle   Rademan GHBH    35.67   8   879 R
  2   Lara    Jordaan GHBH    25.58   5   671 
  3   Martine Hartung PG  24.67   4   650 
  4   Marlie  Theunissen  PG  23.50   3   622 
  5   Rochelle    ROOS    BLRO    21.75   2   578 
  6   Mishka  ELLIS   BLRO    21.20   1   564 
  </code></pre>
  
  <p>The top two lines at the top are the headings. The data underneath must form a table with no border.</p>
  
  <p>Can anyone please help?</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>I tried the following and it worked beautifully:</p>
  
  <pre><code>echo "&lt;html&gt;&lt;body&gt;&lt;table&gt;\n\n";
  $f = fopen("0001.csv", "r");
  while (($line = fgetcsv($f)) !== false) {
          echo "&lt;tr&gt;";
          foreach ($line as $cell) {
                  echo "&lt;td&gt;" . htmlspecialchars($cell) . "&lt;/td&gt;";
          }
          echo "&lt;/tr&gt;\n";
  }
  fclose($f);
  echo "\n&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;";
  </code></pre>
  
  <p>Is it possible to skip the first two lines of the csv file, or better still, keep them separate from the table data which starts on line three?</p>