我的问题很小。我想在'暂停'中添加产品ID。和会话用户名.Product id每次都插入,但用户名不是。
<?php
ob_start();
session_start();
$_SESSION['username'];
if(isset($_GET['add_site'])){
$pro_id=$_GET['add_site'];
$u_name=$_SESSION['username'];
$check_pro="SELECT * FROM holds WHERE p_id=$pro_id AND u_name= $u_name";
$run_check = mysqli_query($connection, $check_pro);
if(mysqli_num_rows($run_check)>0){
$msg="already added";
}
else{
$insert_pro="INSERT INTO `holds` (`p_id`, `u_name`, `status`) VALUES ('$pro_id', '$u_name', 'pending')";
$run_pro= mysqli_query($connection, $insert_pro);
}
}
?>