我正在建立一个电子商务网站,并希望为每个持有所选产品的用户创建一个购物车。我的问题是为什么数据库中没有电子邮件地址?
if(isset($_GET['add_cart']) && $_SESSION['costumer_email']){
global $con;
$email =$_SESSION['costumer_email'];
$pro_id = $_GET['add_cart'];
$check_pro = "select * from cart where email_adress='$email' AND p_id='$pro_id'";
$run_check = mysqli_query($con, $check_pro);
if(mysqli_num_rows($run_check)>0){
echo "";
}
else {
$insert_pro = "insert into cart (p_id,email_adress) values ('$pro_id','$ip')";
$run_pro = mysqli_query($con, $insert_pro);
echo "<script>window.open('index.php','_self')</script>";
}
}
答案 0 :(得分:0)
$insert_pro = "insert into cart (p_id,email_adress) values ('$pro_id','$ip')";
那行不应该是这样的吗?
$insert_pro = "insert into cart (p_id,email_adress) values ('$pro_id','$email')";