title: list data from text file with php
body: <p>I am using a text file as a database. This code only shows the row by the id I select. I want it to show everything from the text file.</p>
  
  <pre><code>&lt;?php
  $lines = file('database.txt');
  $data = array();
  $id = 1;
  
  for($i = 0; $i &lt; count($lines); $i++){
  if($lines[$i] == $id){
      $data[0] = $lines[$i];
      $data[1] = $lines[$i+1];
      $data[2] = $lines[$i+2];
      $data[3] = $lines[$i+3];
  }
  }
  ?&gt;
  
  
  
  &lt;!DOCTYPE HTML&gt;
  &lt;html lang="en-US"&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;link rel="stylesheet" type="text/css" href="style.css" media="all" /&gt;
  &lt;title&gt;Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
  
  &lt;div class="box1"&gt;
     &lt;h1&gt;&lt;?= $data[1]; ?&gt;&lt;/h1&gt;   
     &lt;img src="&lt;?= $data[2]; ?&gt;"&gt;
      &lt;p&gt;
      &lt;?= $data[3]; ?&gt;
     &lt;/p&gt; 
     &lt;br /&gt;
     &lt;a href="&lt;?= $data[4]; ?&gt;"&gt;Click  here!&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div class="box1"&gt;
     &lt;h1&gt;&lt;?= $data[1]; ?&gt;&lt;/h1&gt;   
     &lt;img src="&lt;?= $data[2]; ?&gt;"&gt;
      &lt;p&gt;
      &lt;?= $data[3]; ?&gt;
     &lt;/p&gt; 
     &lt;br /&gt;
     &lt;a href="&lt;?= $data[4]; ?&gt;"&gt;Click  here!&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and here is my database file</p>
  
  <pre><code>    1
      Name
      Image
      My text
      Link
      -------
      2
      Name1
      Image1
      Text1
      Link1
      -------
      3
      Name3
      Image3
      Text3
      Link3
      -------
  </code></pre>