我正在尝试使用php将数据插入到我的数据库表中。但我遇到此错误:
错误:在
vacancies
(名称,描述,位置,工资)中插入值(”,“,”,)您的SQL语法有错误;检查与您的MariaDB服务器版本相对应的手册以在第1行的')'附近使用正确的语法 谁能帮我... 这也是我的代码
<?php
@include('dbh.php');
if(!(empty($_POST))){
$name = $_POST['name'];
$description = $_POST['content'];
$location = $_POST['location'];
$salary = $_POST['salary'];
$sql = "INSERT INTO `vacancies` (name,description,location,salary) VALUES ('$name','$description','$location',$salary)";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
}
?>