title: Displaying table data column-wise in a while loop
body: <p>I'm attempting to retrieve all that data from a database, put it in a table (more than one table if necessary) and display them column-wise in lots of 4 split across multiple pages. </p>
  
  <p>I would like to know how I would get the tables to display horizontally e.g.</p>
  
  <p>Table Header &nbsp; Table Header  &nbsp;Table Header<br>
   Table Data &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Table Data  &nbsp;&nbsp;&nbsp;&nbsp; Table Data<br>
  Table Data &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Table Data  &nbsp;&nbsp;&nbsp;&nbsp; Table Data</p>
  
  <p>Rather than:</p>
  
  <p>Table Header<br>
  Table Data<br>
  Table Data  </p>
  
  <p>Table Header<br>
  Table Data etc.</p>
  
  <p>Here is the code so far:</p>
  
  <pre><code>// While loop that will display the results in groups of 4
  while($row=sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC))
  { $newDate = $row['datenow']-&gt;format('d/m/Y'); ?&gt;
  
  &lt;table id="syncresults"&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th scope="col" id="dateheader"&gt; &lt;?php echo $newDate ?&gt;&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $row['nbsactive']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $row['nbsmanysynced']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $row['nbsthreedays']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>
  
  <p>
  
  <p>Any suggestions on how to do this or to point me in the right direction would be greatly appreciated.</p>