hi, i am doing a shopping cart.i had a variable $total.when i add 1st product of price 200 i get $total=200 , when i add 2nd product of price 100 i get $total=200100 when i add 3rd product of price 400 i get $total=200100400 . i want to get $total=700. how to fix this problem? please help me........
this is the code
session_start();
$ar20=Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'price WHERE id="'.$_SESSION['y'].'" AND prodid="'.$row['id_product'].'" ORDER BY size DESC');
for($i=0;$i < count($ar20);$i++)
{
$test=$test+$ar20[$i]['price'];
}
$row['price'] += $test ;
$row['total'] = $row['price'] * intval($row['quantity']);
if 3 products then echo the $row['total'] will get this 100200300
thanks,
Hmwd