title: PHP loops How to output database results horizontally in html tables
body: <p>I am building a reporting application using PHP/MySQL that outputs a data set based on selected date ranges.Below is a sample of the the data in the database</p>
  
  <pre><code>date           denom     net 
  2014-02-02      5        220,410
  2014-02-02      11       218,460
  2014-02-02      16       81,810
  2014-02-02      22       51,140
  2014-02-02      33       69,900
  
  2014-02-03      5        220,410
  2014-02-03      11       200,460
  2014-02-03      16       71,810
  2014-02-03      22       11,140
  2014-02-03      33       19,900
  </code></pre>
  
  <p>I would like the data to be outputted horizontally using php to something like this</p>
  
  <pre><code>denom               02nd Feb           03rd Feb      
  5                    220410            200,199
  11                   218,460           200,460
  16                   81,810            71,810
  22                   51,140            11,140
  33                   69,900            19,900
  </code></pre>
  
  <p>I have attempted to use a while loop to achieve this but my output is not arranged as it should be above. See the php i used below</p>
  
  <pre><code>$denom_netresult = mysqli_query($con,"SELECT date,denom,net 
                                        from tbl_lending 
                                        WHERE date BETWEEN '2014-02-02' 
                                                       AND '2014-02-03'");
  
  while($row = mysqli_fetch_array($denom_netresult))
  {
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;" . $row['date'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['denom'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['net'] . "&lt;/td&gt;";
   }
   echo "&lt;/tr&gt;";
  </code></pre>
  
  <p>Please assist.</p>