I currently have a page where a user can input a tenants apartment number, the weight of their laundry bag, and the price they pay. Once the information is submitted it gets stored in the data base.

I want to create a page that sums up the totals based on the tenant’s usage. I would also like that everything displays in ascending order. So if i inputted data on tenant 1A who’s bag weighed 10 pounds and cost $15 dollars. And then I inputted data on tenant 1B who’s bag weighed 20 pounds and cost $30 dollars. And then i inputted data on tenant 1A who’s bag weighed 15 pounds and cost $20 dollars. Then on the new page it would display 1A and then 1B. In 1A it would display the total weight as 25 pounds and the total cost would be $35. On the next line there would be tenant 1B with a total weight of 20 pounds and a total cost of $30 dollars.

Essentially I need a way to check the static apartment number, go to the data base, find all of the data entries that match the static apartment number. And then add up the corresponding data points for the requested fields.

Help would be great since I’ve been trying to figure this out for a while. Thank you!