Need help with arrays

Results 1 to 3 of 3

Thread: Need help with arrays

  1. #1
    Join Date
    Dec 1969

    Default Need help with arrays

    Hi there,<BR><BR>Here is the scenario:<BR>I want to calculate the total price for someones order.<BR>How do I loop through my database, make an array of all the items prices that the customer has ordered and then calculate the total?<BR><BR>I am sure this is very easy it just gives me a lot of trouble.<BR><BR>Any help or advise would greatly be appreciated.<BR>Sincerely,<BR>Andre

  2. #2
    Neil Popham Guest

    Default RE: Need help with arrays

    kinda depends on how your database is set up...<BR><BR>if you have customers in one table, and orders in another (the obvious method) then you do not need an array, but can get the total order values using an SQL statement like:<BR><BR>&#062; SELECT Sum(Price) AS TotalOrders FROM Orders WHERE CustomerID = 5<BR><BR>this assumes the prices are in a field called &#039Price&#039 in the orders table &#039Orders&#039, and the customer is linked to their orders using an autonumber field &#039CustomerID&#039...<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Need help with arrays

    open two dim array with item name and price and open the loop to cal the total price of each can store rs rows in array by using getrows property of recordset object

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts