find the total values get in a variable in php
<p>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........</p>

<p>this is the code</p>

<pre><code> session_start();
           $ar20=Db::getInstance()-&gt;ExecuteS('SELECT * FROM '._DB_PREFIX_.'price WHERE id="'.$_SESSION['y'].'"  AND prodid="'.$row['id_product'].'" ORDER BY size DESC');

            for($i=0;$i &lt; count($ar20);$i++)
            {
                $test=$test+$ar20[$i]['price'];
            }




             $row['price'] += $test ;
 $row['total'] = $row['price'] * intval($row['quantity']);
</code></pre>

<p>if 3 products then echo the $row['total'] will get this 100200300 </p>

<p>thanks,</p>

<p>Hmwd</p>
