I've got the following working for printing the data from the sql table. However, I have two goals.
There is a creditcardTotal field that I'd also like to use to make a dailyTotal value. That is what I really want to print. However, I do not want to have a dailyTotal value on the sql side as the data goes back for a while and I don't want to manually update the database.
Once I get the dailyTotal working, I'd like to add those up for a monthlyTotal value.
Honestly, if I could figure out how to actually get the data out of .$data['CashTotal']
. I could probably figure out how to calculate everything myself.
The ultimate goal is to have a a PHP table that shows the dates and the daily totals for a month (for each day) then a total at the bottom.
I can't figure out the term to search to show me what I'm wanting to do.
$result = mysql_query("SELECT * from HP_Closing_Count WHERE '2017-01-01' <= Date and Date < '2017-02-01'");
echo '<table border=2px>'; // opening table tag
echo'<th>Date</th>
<th>Employee</th>
<th>CashTotal</th>
'; //table headers
while($data = mysql_fetch_array($result))
{
// we are running a while loop to print all the rows in a table
echo'<tr>'; // printing table row
echo '<td>'.$data['Date'].'</td>
<td>'.$data['Employee'].'</td>
<td>'.$data['CashTotal'].'</td>
'; // we are looping all data to be printed till last row in the table
echo'</tr>'; // closing table row
}
echo '</table>'; //closing table tag
?>
Date Employee CashTotal
2017-01-04 Jon 931.25
2017-01-05 Robin 0
2017-01-07 Jon 383.5
2017-01-06 Jay 275.25
2017-01-08 Jon 417.5
2017-01-09 Jay 297.75
2017-01-10 Colwyn C 280.5
2017-01-11 Colwyn 344
2017-01-12 Ellen 374.5
2017-01-13 Jay 288.5
2017-01-14 Jay 377.75
2017-01-15 Jay 349.25
2017-01-16 Jay 376.5
2017-01-17 Colwyn 248.5
2017-01-18 Taylor 210.5
2017-01-19 COLWYN 247
2017-01-20 Jay 330.75
2017-01-21 Jay 475.75
2017-01-22 Jay 489.75
2017-01-23 Jay 344
2017-01-24 Parker 321.25
2017-01-25 Taylor 257.25
2017-01-26 Ellen 249
2017-01-27 Jay 318.25
2017-01-28 Jay 477
2017-01-29 Jay 382
2017-01-30 Jay 271.5
2017-01-31 Ellen 230.25