Total for the month
Posted: Sat Jun 14, 2008 11:52 pm
I am using the following code to keep track of purchases. The tracking will return the user, item, month of purchase, total spent, and status of payer. I want to add up all of the purchases made for the month and return that value to the page. My data base is using the standard unix time stamp. Does anyone have any ideas?
Code: Select all
<table width="100%" border="1" cellpadding="5">
<tr><td>User ID</td><td>Item</td><td>Month</td><td>Amount</td><td>Payment<br>Stutus</td><td>Order<br>Stutus</td></tr>
<tr><td colspan="6"> </td></tr>
<?
while ($row = mysql_fetch_assoc($rs_result)) {
$sql2 = "SELECT * FROM payments_log WHERE payment_id ='".$row['payment_id']."'";
$rs_result2 = mysql_query ($sql2);
while ($row2 = mysql_fetch_assoc($rs_result2)) {
$month=date(F,$row2["date"])
?>
<tr>
<td><? echo $row["user_id"]; ?></td>
<td><? echo $row["item"]; ?></td>
<td><? echo $month; ?></td>
<td>$<? echo $row["mcgross"]; ?>.00</td>
<td><? echo $row["payer_status"]; ?></td>
<td><? echo $row["payment_status"]; ?></td>
</tr>
<?
}
};
?>
</table>