有人可以帮助我,告诉我为什么我的php表单没有将数据发送到数据库。
类型为emp_no(int11)
,birth_date(date)
,first_name(varchar14)
,last_name(varchar16)
,gender(enum('M','F')
,hire_date(date)
// Checks to see if the save button was pressed and if so, then it should run the
query that inserts the data into the data fields specified.
if(isset($_POST['save'])) {
$sql = "INSERT INTO 'employees' ('emp_no', 'birth_date', 'first_name',
'last_name', 'gender', 'hire_date')
VALUES ('".$_POST['emp_no']."', '".$_POST['birth_date']."',
'".$_POST['first_name']."', '".$_POST['last_name']."',
'".$_POST['gender']."', '".$_POST['hire_date']."')";
$result = mysqli_query($conn, $sql);
}
答案 0 :(得分:0)
更改为:
if user is in group A, use coupon_1, if user is in group B, use coupon:2...
您还可以使用以下方法返回错误:
$sql = "INSERT INTO employees (emp_no, birth_date, first_name, last_name, gender, hire_date) VALUES ...