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
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
I would like the data to be outputted horizontally using php to something like this
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
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
$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 "<tr>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['denom'] . "</td>";
echo "<td>" . $row['net'] . "</td>";
}
echo "</tr>";
Please assist.