[英]what is for SQL syntax; check the manual that corresponds to your MariaDB server version?
the code is totally true but during execute i face error代码完全正确,但在执行过程中我遇到错误
You have an error in your SQL syntax;
您的 SQL 语法有错误; check the manual that corresponds to your MariaDB server version for the right syntax to use near '52, v@test.com)VALUES ('niki','52','v@test.com')' at line 1
检查与您的 MariaDB 服务器版本相对应的手册,在第 1 行的 '52, v@test.com)VALUES ('niki','52','v@test.com')' 附近使用正确的语法
<?php
if(isset($_POST['submit'])){
$Name= $_POST ['Name'];
$Password = $_POST [ 'Password'];
$Email= $_POST [ 'Email'];
$connection = mysqli_connect('127.0.0.1','root','','loginapp');
if($connection){
echo "Hi Dude , we are conneted";
}else{
die('DataBase is Failed');
}
$query = "INSERT INTO `users`($Name , $Password, $Email)" ;
$query .= "VALUES ('$Name','$Password','$Email')";
$result = mysqli_query($connection , $query);
if (!$result){
die('Query FAILED'. mysqli_error($connection));
}
}else {
echo "Record Create";
}
You must use column names in place of variables in the insert statement.您必须在插入语句中使用列名代替变量。
Insted of插入的
$query = "INSERT INTO
users ($Name , $Password, $Email)" ; $query .= "VALUES ('$Name','$Password','$Email')";
$query = "INSERT INTO
用户($Name , $Password, $Email)" ; $query .= "VALUES ('$Name','$Password','$Email')";
($Name , $Password, $Email)" ; $query .= "VALUES ('$Name','$Password','$Email')";
Use something like this使用这样的东西
$query = "INSERT INTO
users (Name , Password, Email)" ; $query .= "VALUES ('$Name','$Password','$Email')";
$query = "INSERT INTO
用户(Name , Password, Email)" ; $query .= "VALUES ('$Name','$Password','$Email')";
(Name , Password, Email)" ; $query .= "VALUES ('$Name','$Password','$Email')";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.