购物车,数量之分明


shopping cart, matter with quantity

这是一个磨砂车,工作很好,但问题是数量,当数量为 1 时,我喜欢自动获得single_price任何建议:

$global = 0;
if(isset($_POST['update_cart'])){
    if(isset($_POST['qty'.$i])){
        $qty = $_POST['qty'.$i];
    }else{
        $qty+=1;    
    }
    $update_qty = "update cart set qty='$qty'";
    $run_qty = mysqli_query($con, $update_qty); 
    $_SESSION['qty']=$qty;

    $global = $global+ ($single_price*$qty); 

    $total =$total + ($values * $qty);

}

我看到连接替换这个的问题:

$update_qty = "update cart set qty='$qty'";

有了这个:

$update_qty = "update cart set qty='".$qty."';