Jump to content

adding two mysql value fields and getting a total.


blmg2009

Recommended Posts

Hi there, 

 

I'm currently teaching myself PHP and MYSQL, so I'm struggling to think of the way to do the following:

 

I have a table for order_products, this includes a list of all products on a customers order. 

 

I have two fields in this table that are

 

price & tax

 

I need to add these to values together to get a total but I also need to run a total all all the products in that order, so for example:

 

 

Order_product_id      order_id     Price       Tax 

        1                           4              30.00        5.00     

 

Order_product_id      order_id     Price       Tax 

        2                           4              20.00        7.00  

  

Order_product_id      order_id     Price       Tax 

        3                           4              10.00        5.00     


I have added all the values of a single field before but never had to add two fields together and get all other totals 

 

 

If anyone has the answer to my problem it would be greatly appreciated :)

 

Thanks for reading.  

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.