i need to write code that sums amounts in chunks.
For example, if a query returns 12 results i need to sum 1 - 6, 7 - 12.
my output page creates a page break after every 6 records, i need to print the total for that page right before the page break.
without seeing your code i can only guess as to how the vars are displayed.
You could just create another var and add the values to that var.
right before you page break, display that var then set it to 0.
I am imagining your page breaks are next page. You will need to pass a variable from one page to the next.
$sum = 0; // query // while or for loop } // echos $sum = $sum + $row["qty"]; }
Link to next page
echo "<a href=\"path/page.php?pagesum=$sum\">Next Page</a>\n";