Code: Select all
Month Sales Orders Average
November, 2006 $100.00 2 $50.00
October, 2006 $150.00 3 $50.00
September, 2006 $0.00 1 $0.00I've got it set-up in my function to add the prices together, but how do I get it to pull two values from the one function? Using an Array of course however my problem is that at the end of the function, I call the function again... When I call ti again, in the $month field I add $month - 1 so that I gets orders from the previous month.
How do I get the function to read the array values added by the function within itself add that to the overall array?
I don't know if I'm making sense.... Let me know if I'm not.
Here is a snippet of my function:
Code: Select all
function statistics($month, $year, $price, $count) {
$price = $price + $total_price; // This adds the total price of the orders for this month to the overall price ($price)
$orders .= "<tr>\n<td>".date('F, Y', $this_month)."</td><td>$".number_format($total_price, 2)."</td><td>".$orders_count."</td><td>$".number_format($sales_average, 2)."</td>\n</tr>\n"; // This displays the details for the order which I displayed above
$orders .= statistics($month - 1, $year, $price, $count +1); // This calls the function again however it gets results for the previous month
return $orders;
}