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.  

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.