error_reporting(0);
$code = $_POST["code"];
$name = $_POST["name"];
$date = $_POST["date"];
$age = $_POST["age"];
$job = $_POST["job"];
$department = $_POST["department"];
$month = $_POST["month"];
$year = $_POST["year"];
$politics = $_POST["politics"];
$health = $_POST["health"];
$db = new MySQLi("localhost:3306","user","password"); //连是能连上的
!mysqli_connect_error() or die("连接失败!");
$sql = "insert into `员工信息` values('{$code}','{$name}','{$date}',
'{$age}','{$job}','{$department}','{$month}','{$year}','{$politics}','{$health}')";
$result = $db->query($sql); //添加时一直是false
if($result)
{
echo "添加成功!";
header("location:work.php");
}
else
{
echo "添加失败!";
}
?>
//18行的if一直跳转到else,可能是¥db->query($sql)的问题
展开