I am doing sum with the below query but it is not giving result properly.
If there are four items and it is showing the result like: 1.000 2.000 3.000 4.000 and it should be like 10.000
I don't know where I am mistaken please help.
<?php
$order_temp =   mysql_query("select * from temp_cart
where item_id = '".$mitem_idC."'  and ses_mem=113 order by id");
while ($torder = mysql_fetch_array($order_temp)) {
    $prITTC     =   $torder['item_id'];
    $qtyT       =   $torder['qty']; 
    $chTP   =   mysql_query("
    select * from temp_choices
    where item_id = '".$prITTC."'
    AND ses_mem = 113
    AND status = 1
    ");
    while($chGET    =   mysql_fetch_array($chTP)){
    $fID    =   $chGET['id'];
    $field  =   $chGET['choice_id'];
    $order_tempCHP      =   mysql_query("
    select sum(price) as total, id, ename, choice_id, item_id, price
    from choice_price
    WHERE
     id IN('$field')
    ");
    while ($torderCP    = mysql_fetch_assoc($order_tempCHP)){
    $totalCH    =   $torderCP['total'];
    $tsl    = $totalCH+($qtyT*$prIDTC);
$altsl  = number_format($tsl, 3, '.', '');
echo $altsl;
    } }
}
?>

 
    