Bir dizide saklanan değerlerin bir dizi bir alt toplam ve toplam hesaplamak için çalışıyor Im bir mysql veritabanı döndü.
Bu ne i i thusfar var
while($row = mysql_fetch_array($cart)){
foreach($row AS $key => $value) { $row[$key] = stripslashes($value); }
$id = $row['id'];
$contents = unserialize($row['contents']);
foreach( $contents as $key => $value){
if($key == "price"){$subtotal = $subtotal+$value;}
echo "$key : $value <br />";
}
echo "<br><br><br>";
}
echo "<font color=red>SubTotal $subtotal</font>";
$ Içeriğini bir dizi içerir [name] => super [price] => 65.87 [quantity] => 25
Yani ben miktara göre fiyat çarpmak gerekir, ve sonra döngü sonra (ürün başına) bu alt toplamını almak ve toplam eklemek