$connect = mysqli_connect("localhost", "root", "", "hempbag_db") or die("Connection failed");
foreach($a as $b){
foreach($b as $c){
$query5 = "SELECT P_price tbl_products WHERE PID='".$c['PID']."' ";
$get_price = mysqli_query($connect, $query5);
$get_price1 = mysqli_fetch_assoc($get_price);
$price = ($get_price1['P_price'])+ $price + 0; // This does not add
}
}
$price
does not add only takes the last value of the data inside the loop.
How can I add them?
I also used:
$price = ($get_price1['P_price'])+0;
$new_price += $price;
Still failed.
Thank You!