title: How to print data in a table from mysql
body: <p>I want to extract the last eight entries from my database and print them into a two columns table like this:</p>
  
  <pre><code>|1|2|
  |3|4|
  |5|6|
  |7|8|
  </code></pre>
  
  <p>Is that possible?</p>
  
  <p>This is my code:</p>
  
  <pre><code>$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
  $db-&gt;connect(); 
  
      $sql = "SELECT ID, movieno
              FROM movies
              ORDER BY ID DESC
              LIMIT 8 ";
  
      $rows = $db-&gt;query($sql);
  
      print '&lt;table width="307" border="0" cellspacing="5" cellpadding="4"&gt;';
      while ($record = $db-&gt;fetch_array($rows)) {
          $vidaidi = $record['movieno'];
          print &lt;&lt;&lt;END
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="http://www.dadadada.com/watch?v=$vidaidi" target="_blank"&gt;
  
                  &lt;img src="http://img.dadadada.com/vi/$vidaidi/1.jpg" width="123" height="80"&gt;&lt;/a&gt;   
              &lt;/td&gt; 
          &lt;/tr&gt;
      END;
      }
      print '&lt;/table&gt;';  
  </code></pre>