title: HTML table in PHP
body: <p>I have the following code but it's not working like I want it to work. I just want the table header to be shown once but now it repeats the header everytime. And I want the table header to be horizontally but now it is vertically.</p>
  
  <p>code:</p>
  
  <pre><code>&lt;?php
  include ("core/db_connectie.php");
  
  //file_get_contents("main.tpl.php");
  
  $query = "SELECT * FROM platen";
  $result = mysql_query($query) or die (mysql_error());
  
  $table = "&lt;table&gt;"; 
  
  $cName = "";
  $cValue = "";
  
  while($row = mysql_fetch_assoc($result))
  {   
      foreach($row as $columnName=&gt;$columnValue)
      {
          $cName .= $columnName;
          $cValue .= $columnValue; 
      }
  }
  
  $table .= "&lt;tr&gt;&lt;th&gt;". $cName ."&lt;/th&gt;&lt;/tr&gt;"; 
  $table .= "&lt;tr&gt;&lt;td&gt;". $cValue ."&lt;/td&gt;&lt;/tr&gt;"; 
  
  $table .= "&lt;/table&gt;"; 
  
  echo $table;
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I changed the code but it's still not working now it just paste everything after eachother</p>
  
  <p>Example:</p>
  
  <pre><code>IDAlbumBandStijlMediumDatumPrijsIDAlbumBandStijlMediumDatumPrijs
  1TestTestereRockLP2013-06-1202TestTestereRockLP2013-06-1213
  </code></pre>