Maybe I'm thick, but I still don't understand your code. I think you're making the whole process overly complicated. Let's say you want to store your cart in a single session variable that you can unset once you are done with it. Assuming a single user can only have one cart, your array might be $_SESSION['cart'].
So now let's say the user adds an item to their cart. I can only think of 3 pieces of information you'd need for an item (assuming the rest is stored in your database): item number, quantity, and maybe coupon code. So now you've got: $SESSION['cart']['item1']['item_no'], $SESSION['cart']['item1']['quantity'], and $_SESSION['cart']['item1']['discount'].
So you've got the SESSION array, but you're only dealing with a single cart. Then you've got a number of items in a cart which may grow, but will only ever have 3 pieces of information associated with them.
Now you need to display your cart:
$items = $_SESSION['cart'];
foreach($items as $item)
{
// Get item info...
$query = "SELECT description, price FROM Items WHERE item_no = ".$item['item_no'];
$result = mysql_query($query, $link);
$row = mysql_fetch_assoc($result);
extract($row);
// Calculate discounts...
if($item['discount'] != 0)
$price = $price - $item['discount'];
// Calulate line total...
$line_tot = $price * $item['quantity'];
// Display line item...
echo $item['item_no']." - ".$description." - ".$price." - ".$item['quantity'].
" - ".$line_tot."<br>";
}
Obviously, I'm keeping it simple here. You'd want to add a table and fields for changing the quantity before checkout.