Hi,

I have a php/mysql ordering system which basically inserts the orders into a database and sends the customer an email responder. There is only one product and the price is fixed but if someone orders more than one product, I want the email to reflect the total price.

I have the quantity in a selection list 1,2,3,4 etc. with corresponding values so that the database will show the ordered quantity. But how do I assign the price and match this to the quantity ordered? I'm sure it's probably fairly basic, but I've been working flat out for days and can't get my head around this one.

Any help appreciated! 🙂

    Need to look at the database structure, and see exactly how you are trying to store it... But, PHP has all of the Arithmetic Operators you would need to do the actual math... The principles are the same as 4th grade math in regards to the order of operations...

    In other words...

    $totalprice = ((($qtyproduct1$price1)+($qtyproduct2$price2))*1.05)+4;

    Would factor the price of product1 based on the quantity, and the same for product2. Then it adds 5% sales tax and then adds 4 dollars for shipping to give you a total price.

    But, we'd need more info to see exactly what you are trying to accomplish (including any applicable code you may already have)

      thanks for that. I'm now passing the amount charged in a hidden field so the value of the field is:

      <?php echo $row['quantity']*35; ?>

      This works well and stores into the total into a field called 'price'. Now I need to know how to format the price into currency in mysql.

      :rolleyes:

        Write a Reply...