Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - totals
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

totals

 Post Reply Post Reply
Author
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Topic: totals
    Posted: 18 May 2003 at 3:28pm

help again please chaps and chappesses....

ive got a table in the MY BASKET section of my site which shows Item number, name, price per unit, quantity, and total for item (Which is price X quantity).

Now, at the end of my code i have a total value, which adds all the prices together.... thats my problem though.  It adds the prices per unit, not with the quantity too.  Am i being clear?  I only have a PRICE column in my database, not one which does the calculating for me.  I do that on the ASP page.  How do i get it to add all the values together of PRICE X QUANTITY from records which have been filtered in the SQL when the DB opened.

Hope you can help as this is really baffling me now.

Cheers folks,

Matt



Edited by Mattblack - 30 June 2005 at 1:58pm
Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2003 at 4:11pm

I dont know if i Completely follow you, but do you mean something like this?

WHILE NOT rs.EOF

    price = rs("price")

    quantity = rs("quantity")

    tempTotal = price * quantity

    total = total & tempTotal

rs.moveNext

WEND



Edited by ultramods
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2003 at 7:21pm
If you have the price and the quantity stored in the database just return the price, quantity, and price * quantity with your SQL query,

select price, quanitity, price*quantity from ...


than you can add the total of price * quantity togther as listed above. I try to return the data as close as possible to form I need for display as it just take less time overall. Personal, I would just query the database for the total using,

select sum(price*quantity) from ...

Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2003 at 4:01pm

it worked!!!

Cheers guys, ur such a help

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.