Hi,
I am trying to find the sum of product's weight and can't seam to find anything that can help. I have included my code snippet below.
$totalweight = 0;
foreach($_SESSION['ddc']['productsincart'] as $key => $value) {
$sql = "SELECT * FROM ddcart_products WHERE id = '".$key."'";
$result = mysql_query($sql);
$data = mysql_fetch_assoc($result);
//$totalweight = $totalweight+$data['weight'];
echo '<br>';
echo $data['name'];
echo '<br>';
echo 'Weight: '.$data['weight'];
echo '<br>';
echo 'Qty: '.$value;
echo '<br>';
$weight = $value * $data['weight'];
echo 'Total Weight: '.$weight;
echo '<br>';
}
How can i add up and display the total weight ($weight
) for everything listed?
Thank's for your help.
Zack.