我已经做了一个简单的PHP数据库的cms表单,但它不能正常工作,当我想提交表单与一些虚拟数据!我不知道为什么会发生&也是我加入了mysqli_error()得到错误的,我现在面临与类型,但我只拿到了这一点:意外的错误消息在PHP表单(SQL语法错误)
您的SQL语法错误;检查对应于你的MySQL服务器版本正确的语法使用手动近“”,“”,“在行”)” 2
if (isset($_POST['submit'])){
$post_title = $_POST['title'];
$post_date = date('d-m-y');
$post_author = $_POST['author'];
$post_keywords = $_POST['keywords'];
$post_content = $_POST['content'];
$post_image = $_FILES['image']['name'];
$image_tmp = $_FILES['image']['tmp_name'];
if ($post_title=='' or $post_keywords='' or $post_content='' or $post_author=''){
echo '';
}else{
move_uploaded_file($image_tmp,"post_images/$post_image");
$insert_query = "INSERT INTO posts
(post_title,post_date,post_author,post_image,post_keywords,post_content) VALUES ('$post_title','$post_date','$post_author',$post_image','$post_keywords','$post_content')";
$insert_post = mysqli_query($con,$insert_query);
if ($insert_post){
echo '
Post has been added successfully.
';}else{
echo mysqli_error($con);
}
}
}
?>
Insert Post Title | |
Insert Post Author | |
Insert Post Keywords | |
Insert Post Image | |
Insert Post Content | |
如果您分享您的解决方案这将是对我很有帮助对于这个问题...谢谢!