Adding Total Cost - ASP while
I'm a simple cart page that displays content in a table and I'm trying to figure out a way to add a Cost column and then display the total price at the bottom. Does anyone have any suggestions on how to do this? The part that is confusing me is that it is dynamically created via ASP.
My code can be found here: http://pastie.org/341676
Any suggestions?
+1
source to share
1 answer
First, it is a special kind of painful (asp classic in all its glory)
You need another variable to store your values, then sum it up in each loop iteration
While Not objRS.EOF
totalCost = trim(objRS.Fields("quantity"))*trim(objRS.Fields("p_price"))
absoluteTotal = absoluteTotal + totalCost
...
Wend
Response.Write absoluteTotal
This will output the sum of all totals, although you probably want to format it better with html and whatnot
+3
source to share