Hi,all i have a shopping cart page where on the catalog page it displays the items the user can buy when the user selects the items he or she wants.
which is displayed below

PHP Code:
        include("dbconnect.php");
        $items=array();
        $prices=array();
        $desc=array();
/*
    catalog.php and cart.php work together as a basic example of implementing
    a web based catalog shopping cart. What is not included is the faclity for
    executing the final secure financial transaction. These are normally supplied
    by the merchant's bank, or specialists services like www.paypal.com
    */
    // cart must persist thru visit to site
    session_start(); // start a new session or reopen the existing one
    if (!isset($_SESSION['cart'])) { // if no cart
        $_SESSION['cart'] = array(); // create an empty one
    }

    if (isset($_GET['buy'])) { // if a "buy" query string is present
        // add the item to the end of the session cart array
        $_SESSION['cart'][] = $_GET['buy'];
        // redirect the browser  back to this same page but without a query string
        // note: just incase cookies are disabled, pass the session ID as a query string
        header('location: '.$_SERVER['PHP_SELF'].'?cid='.$_GET['cid']);
        exit(); // skip the rest of this script
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Crispy Imports Catalog Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles/crispyimports.css" rel="stylesheet" type="text/css">
</head>
            <style type="text/css">
                @import url(styles/crispyimports.css);
            </style>
<body>
<div id="container">
<div id="header"><img src="images/crispyimportlayoutpsd_02.gif" alt="Header"></div>
<div id="nav" style="background-image: url(includes/crispyimportlayoutpsd_03.gif);">
<br>
        <a href="index.php">Home</a>&nbsp;|&nbsp;
        <a href="index.php">New Products</a>&nbsp;|&nbsp;
        <a href="contacts.php">Contacts</a>&nbsp;|&nbsp;
        <a href="lat.php">Limited Time Only Products</a>&nbsp;|&nbsp;
        <a href="invoice.php">Customer Login</a>&nbsp;|&nbsp;
          <a href="admin/index.php">Admin</a></div>
<?php include("includes/nav.inc.php"); ?>
<div id="containerbody">
<p>Your shopping cart contains <?php echo count($_SESSION['cart']); ?> items.
<?php
$cid
=($_GET['cid']);
                            if(
$_GET['cid'])
                            {
                                
$cQuery="SELECT * FROM products WHERE cid=$cid";
                                
$result=mysqli_query($con,$cQuery);
                                if(!
$result)
                                {
                                    echo 
"Error:".mysqli_error($con);
                                }
                                else
                                {
                                    
$count=$result->num_rows;
                                    if(
$count>0)
                                    {
                                        while(
$data=$result->fetch_assoc())
                                        {
                                            
$pid=$data['pid'];
                                            
$items[]=$data['productName'];
                                            
$images=$data['image'];
                                            
$imagesalttag=$data['imagesalttag'];
                                            
$prices[]=$data['ProductCost'];
                                            
$desc[]=$data['ProductDescription'];
                                        }
                                    }
                                    else
                                    {
                                    echo 
"There is no products in the catalog,Please contact the webmaster of this store";
                                    }
                                }
                            }
 echo 
"<a href=\"cart.php?cid=".$cid."\">View your cart</a></p>";?>
<input type="hidden" name="cid" value="<?php $cid ?>">
<p><table border="1">
    <thead>
        <tr>
            <!--<th>Picture</th>-->
            <th>Item Name</th>
            <!--<th>Item Description</th>-->
            <th>Price</th>
            <th></th>
        </tr>
<?php
for ($i 0$i count($items); $i++) {
        echo 
"<tr><td><a href=products.php?pid=".$pid.">".$items[$i]."</a></td>";
        echo 
'<td>$'.number_format($prices[$i], 2).'</td>';
        
// each item has a "Buy" link back to this self same page with a query ?buy=0 (0 = the catalog index) query string;
        
echo '<td><a href="catalog2.php?cid='.$cid.'&buy='.$i.'">Buy</a></td></tr>';
            }
?>
</table>
<p>All prices are in New Zealand dollars.</p>    
</body>
</div></div>
Now,When the user clicks on view cart they are taken to the cart.php page.

PHP Code:
        error_reporting(E_ALL);
        $items=array();
        $prices=array();
        include("dbconnect.php");
    // please refer to the companion file catalog.php, which is very similar to this one
    // and here only differences are commented.
    session_start();
    if (!isset($_SESSION['cart'])) {
        $_SESSION['cart'] = array();
    }

    if (isset($_GET['empty'])) {
        // Empty the shopping cart array
        unset($_SESSION['cart']);
        echo "<title>Crispy Imports</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<link href=\"includes/styles/crispyimports.css\" rel=\"stylesheet\" type=\"text/css\">
</head>
            <style type=\"text/css\">
                @import url(styles/crispyimports.css);
            </style>
<body>
<div id=\"container\">
<div id=\"header\"><img src=\"images/crispyimportlayoutpsd_02.gif\"></div>
<div id=\"nav\" style=\"background-image: url(includes/crispyimportlayoutpsd_03.gif);\">
<br/>
        <a href=\"index.php\">Home</a>&nbsp;|&nbsp;
        <a href=\"index.php\">New Products</a>&nbsp;|&nbsp;
        <a href=\"contacts.php\">Contacts</a>&nbsp;|&nbsp;
        <a href=\"lat.php\">Limited Time Only Products</a>&nbsp;|&nbsp;
        <a href=\"profile.php\">Customer Login</a>&nbsp;|&nbsp;
          <a href=\"admin/index.php\">Admin</a></div>";
        include("includes/nav.inc.php");
        ?>
<div id="containerbody">
<?php
        
echo "Successfully Removed items<br/>";
        echo 
"<a href=\"index.php\">Return to Catalog</a>";
        
//header('location: '.cart.php.'?cid='.$_GET['cid']);
        
exit();
    }
                            
$cid=($_GET['cid']);
                            
//echo "The Cid is"; 
                            //echo $cid;
                            
if($_GET['cid'])
                            {
                                
$cQuery="SELECT * FROM products WHERE cid=$cid";
                                
$result=mysqli_query($con,$cQuery);
                                if(!
$result)
                                {
                                    echo 
"Error:".mysqli_error($con);
                                }
                                else
                                {
                                    
                                    
$count=$result->num_rows;
                                    if(
$count>0)
                                    {
                                        while(
$data=$result->fetch_assoc())
                                        {
                                            
$items[]=$data['productName'];
                                            
$prices[]=$data['ProductCost'];
                                            
$desc[]=$data['ProductDescription'];
                                        }
                                    }
                                    else
                                    {
                                    echo 
"There is no products in the catalog,Please contact the webmaster of this store";
                                    }
                                }
                            }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Crispy Imports View Cart</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles/crispyimports.css" rel="stylesheet" type="text/css">
</head>
            <style type="text/css">
                @import url(styles/crispyimports.css);
            </style>
<body>
<div id="container">
<div id="header"><img src="images/crispyimportlayoutpsd_02.gif" alt="Banner"></div>
<div id="nav" style="background-image:url(crispyimportlayoutpsd_03.gif);">
        <a href="index.php">Home</a>&nbsp;|&nbsp;
        <a href="index.php">New Products</a>&nbsp;|&nbsp;
        <a href="contacts.php">Contacts</a>&nbsp;|&nbsp;
        <a href="lat.php">Limited Time Only Products</a>&nbsp;|&nbsp;
        <a href="invoice.php">Customer Login/Continue Shopping.</a>&nbsp;|&nbsp;
          <a href="admin/index.php">Admin</a></div>
<?php include("includes/nav.inc.php"); ?>        
<div id="containerbody">
<h1>Your Shopping Cart</h1>
<input type="hidden" name="cid" value="<?php $cid ?>">
<?php
                                $cQuery
="SELECT * FROM products";
                                
$result=mysqli_query($con,$cQuery);;
                                if(!
$result)
                                {
                                    echo 
"Error:".mysqli_error($con);
                                }
                                else
                                {
                                    
$count=$result->num_rows;
                                    if(
$count>0)
                                    {
                                        while(
$data=$result->fetch_assoc())
                                        {
                                            
$items[]=$data['productName'];
                                            
$prices[]=$data['ProductCost'];
                                        }
                                    }
                                    else
                                    {
                                    echo 
"There is no products in the catalog,Please contact the webmaster of this store";
                                    }
                                }
?>
<p><table border="1">
    <thead>
        <tr>
            <th>Item Description</th>
            <th>Price</th>
        </tr>
    </thead>
    <tbody>
<?php
    $total 
0// add up the total
    // list the quantities in the cart rather than the catalog
    
for ($i 0$i count($_SESSION['cart']); $i++) {
        echo 
'<tr><td>'.$items[$_SESSION['cart'][$i]].'</td>';
        echo 
'<td align="right">$'.number_format($prices[$_SESSION['cart'][$i]], 2).'</td></tr>';
        
$total += $prices[$_SESSION['cart'][$i]];
    }
?>
</tbody><tfoot>
    <tr>
        <th align="right">Total:</th>
        <th align="right">$<?php echo number_format($total2); ?></th>
    </tr>
</tfoot></table></p>
<p><a href="index.php">Continue Shopping</a> or
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?empty=1"> Empty your cart</a>
<?php
// echo "<a href=\"cart.php?cid=".$cid."'&empty=\"1\">Empty your cart</a>";
//echo "<a href=\"cart.php?cid=".$cid."\">View your cart</a></p>";
echo "&nbsp;<a href=\"invoice.php?cid=".$cid."\">Procced to Checkout</a>";
?>
</div>
</div>
</div>
</body>
</head>
</html>
When they Proceed to Checkout they come to a page that displays wat the user has choosen.this is the code below

PHP Code:
        $items=array();
        $prices=array();
        $pid=array();
        $stocklevel=array();
        include("dbconnect.php");
    // please refer to the companion file catalog.php, which is very similar to this one
    // and here only differences are commented.
    session_start();
    if (!isset($_SESSION['cart'])) {
        $_SESSION['cart'] = array();
    }

    if (isset($_GET['empty'])) {
        // Empty the shopping cart array
        unset($_SESSION['cart']);
        header('location: '.$_SERVER['PHP_SELF'].'?'.SID);
        exit();
    }
    //getting cid number from database
    $cid=($_GET['cid']);
                            //echo "The Cid is"; 
                            //echo $cid;
                            if($_GET['cid'])
                            {
                                $cQuery="SELECT * FROM products WHERE cid=$cid";
                                $result=mysqli_query($con,$cQuery);
                                if(!$result)
                                {
                                    echo "Error:".mysqli_error($con);
                                }
                                else
                                {
                                    
                                    $count=$result->num_rows;
                                    if($count>0)
                                    {
                                        while($data=$result->fetch_assoc())
                                        {
                                            $items[]=$data['productName'];
                                            $prices[]=$data['ProductCost'];
                                            $desc[]=$data['ProductDescription'];
                                        }
                                    }
                                    else
                                    {
                                    echo "There is no products in the catalog,Please contact the webmaster of this store";
                                    }
                                }
                            }
    //getting product information from database

                                $cQuery="SELECT * FROM products";
                                $result=mysqli_query($con,$cQuery);;
                                if(!$result)
                                {
                                    echo "Error:".mysqli_error($con);
                                }
                                else
                                {
                                    $count=$result->num_rows;
                                    if($count>0)
                                    {
                                        while($data=$result->fetch_assoc())
                                        {
                                            //echo " here is &nbsp;".$data['productName'];
                                            $pid[]=$data['pid'];
                                            $items[]=$data['productName'];
                                            $prices[]=$data['ProductCost'];
                                            $stocklevel[]=$data['stocklevel'];
                                            //$data['prices']//$prices =mysqli_fetch_assoc();
                                        }
                                    }
                                    else
                                    {
                                    echo "There is no products in the catalog,Please contact the webmaster of this store";
                                    }
                                }
?>
<?php
    $cQuery
="select * from gcertificated";
                
$rs=mysqli_query($con,$cQuery);
                if(!
$rs)
                {
                    echo 
"Error:".mysqli_error($con);
                }
                else
                {
                    
$count=$rs->num_rows;
                    
//echo $count;
                    
if($count>0)
                    {
                        
$data=mysqli_fetch_assoc($rs);
                        
$gca=$data['gca'];
                    }
                }
    
$total 0// add up the total
    // list the quantities in the cart rather than the catalog
    
for ($i 0$i count($_SESSION['cart']); $i++) {
        echo 
'<tr><td>'.$pid[$_SESSION['cart'][$i]].'</td><td> &nbsp;'.$items[$_SESSION['cart'][$i]].'</td>';
        echo 
'<td align="right">&nbsp;$'.number_format($prices[$_SESSION['cart'][$i]], 2).'<br/></td></tr>';
        
$total += $prices[$_SESSION['cart'][$i]];
    }
    echo 
"<tr>
                                    <th align=\"right\">Total:</th><br />"
;
                                    echo 
"<th align=\"right\">$";
                                    echo 
number_format($total2);
                                    echo
"</th>
                                    </tr></table>"
;
    
//$total-=$gca;
?>
        <?php
        
include("includes/giftcertificate.inc.php");
Now what i want to do is to insert what the customer has chosen and inserted it into a field called items in database called customers this is what i have that inserts it into the database.

PHP Code:
    $cQuery="SELECT * FROM products";
                                
$result=mysqli_query($con,$cQuery);
                                if(!
$result)
                                {
                                    echo 
"Error:".mysqli_error($con);
                                }
                                else
                                {
                                    
$count=$result->num_rows;
                                    if(
$count>0)
                                    {
                                        while(
$data=$result->fetch_assoc())
                                        {
                                            
$items[]=$data['productName'];
                                            
$prices[]=$data['ProductCost'];
                                            
$desc[]=$data['ProductDescription'];
                                        }
                                    }
                                    else
                                    {
                                    echo 
"There is no products in the catalog,Please contact the webmaster of this store";
                                    }
                                }
                            
//}
    
$count=count($items);
    
$sql="update customer set items='";
$i=1;
foreach(
$items as $key=>$item)
{
    if(
$i !=$count)
    {
        
$sql.="$item,";
    }
    else
    {
        
$sql.="$item' Where username='".$_SESSION['user']."'";
    }
    
$i++;
}
echo 
$sql;
    
$sql="insert into customer AmountOwe values'";
$i=1;
foreach(
$items as $key=>$item)
{
    if(
$i !=$count)
    {
        
$sql.="$item,";
    }
    else
    {
        
$sql.="$item' Where username='".$_SESSION['user']."'";
    }
    
$i++;
}
//$rs1=serialize($sql);
//echo $rs1;
$rs=mysqli_query($con,$sql); 
Now How can i go about this?

Thanks,