I have 2 different items in cart, each with 5 qty.
This function is returning 10. Help?
[php]function get_description(){
$max=count($_SESSION[‘cart’]);
$sum="";
for($i=0;$i<$max;$i++){
$pid=$_SESSION[‘cart’][$i][‘productid’];
$q=$_SESSION[‘cart’][$i][‘qty’];
$desc=get_product_name($pid);
$stringno = " " . $q;
$sum += "\n " . $stringno . " " . $desc;
}
return $sum;
}[/php]
get_product_name();
[php] function get_product_name($pid){
$result=mysql_query(“select name from items where id=$pid”);
$row=mysql_fetch_array($result);
return $row[‘name’];
}[/php]