Skip to content
Advertisement

How to calculate total price in php

I am getting the price of the product from db using the product id i have stored in php array.

i have a php function where in i want to hold a total of all the products purchased. here i am getting the cart items and i am calling the function which should hold total amount. i am passing the value price each time when i retrieve the product from cart.

for example for first item iteration i send value 300, and for second 400, for third 900.

i want to add up all these and get total price of 1600 in payableAmount() how can i do this?

JavaScript

Advertisement

Answer

You just simply update your query instead like as

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement