Problem adding products to cart

0

$id= $_POST['id'];
if(!isset($_SESSION['itens'])){
    $_SESSION['itens'] = array();
}

if(isset($_POST['id'])){
    $id= $_POST['id'];

    if(!isset($_SESSION['itens'][$id])){
        $_SESSION['itens'][$id] = 1;
    }else{
        $_SESSION['itens'][$id] += 1;
    }
}



$consulta = "SELECT * FROM informaoces WHERE id='$id'";
$con = mysqli_query($mysqli,$consulta);
?>

                          Product's name             price             amount              

What is the problem with this code, When I add other products to the cart, they do not get added in the same table, now if I get adding the same products more than once, increases the quantity, now if I add another product different; does not go to the same table

    
asked by anonymous 04.05.2018 / 22:35

0 answers