通过会话制作电子商务网站问题

I using two sessions one for add to cart and one for the user. But when i add any product to cart it remain in the cart for all the users. So let me know how can a particular user has it own product in his cart and doesn't show the same product for all the users.

Here is the code for add to cart link

if(isset($_GET['add'])){
 $query = query("SELECT * FROM product WHERE product_id=" . escape_string($_GET['add']). " ");
 confirm($query);
    while($row = fetch_array($query)){
        if($row['product_quantity'] !=$_SESSION['product_' . $_GET['add']]){
            $_SESSION['product_' . $_GET['add']]+=1;
               redirect("cart.php");
        }

    }

}

and code for showing product in cart

foreach($_SESSION as $name =>$value){
        if($value > 0){
                    if(substr($name, 0, 8) == "product_"){

                        $length = strlen($name) - 8;
                        $id = substr($name, 8 );
    $query = query("SELECT * FROM product WHERE product_id = " . escape_string($id) . " " );
    confirm($query);