尝试在xampp服务器上的myslqli数据库中插入值时出现错误

时间:2020-03-14 19:31:31

标签: php mysqli insert

错误:1 您的SQL语法有误。检查与您的MariaDB服务器版本相对应的手册以获取正确的语法,以在第1行的'1'附近使用

这是我的代码

<?php 
require('db_connect.php');

//Code for Registration 
if(isset($_POST['submit']))
{
    $name=$_POST['name'];
    $email=$_POST['email'];
    $password=$_POST['password'];
    $query="INSERT INTO `user`(`Id`, `name`, `email`, `password`) VALUES ('','$name','$email','$password')";
    $msg=mysqli_query($connection,$query);


if ($connection->query($msg) === TRUE)
{
    echo "New record created successfully";
} 
else
{
`enter code here`echo "Error: " . $msg . "<br>" . $connection->error;
}
}
?>

1 个答案:

答案 0 :(得分:-1)

您的sql版本是什么? 您应该检查值version: "3" services: server: image: asubscriber/eshop:1.0.1 build: context: . network_mode: "host" expose: - 9080 是否返回数据 如果任何一个值在您的数据库中接受null