通过PHPI'在mysql中插入元素;我得到语法错误
这是一个错误:通过PHPI'在mysql中插入元素;我得到语法错误,php,mysql,sql,syntax-error,sql-insert,Php,Mysql,Sql,Syntax Error,Sql Insert,这是一个错误: INSERT INTO registration_table(username,password,email,phonenum)VALUES ('rahul','hdhh','rahul@gmail.com','7386627473') 你的密码有错误 您的SQL语法;检查与您的产品相对应的手册 要使用正确语法的服务器版本 '名称、密码、电子邮件、phonenum)值 ('rahul','hdhh','rahul@gmail.com一号线的“738662747”` 在值之前提
INSERT INTO registration_table(username,password,email,phonenum)VALUES
('rahul','hdhh','rahul@gmail.com','7386627473')
你的密码有错误
您的SQL语法;检查与您的产品相对应的手册
要使用正确语法的服务器版本
'名称、密码、电子邮件、phonenum)值
('rahul','hdhh','rahul@gmail.com一号线的“738662747”`
在值之前提供空格并重试一次
INSERT INTO registration_table(user name,password,email,phonenum) VALUES('$user_name','$password','$email','$phonenum')
在值之前提供空格并重试一次
INSERT INTO registration_table(user name,password,email,phonenum) VALUES('$user_name','$password','$email','$phonenum')
空格创建问题列名user name
在backtick中使用它。最好使用bind prepare语句
$stmt = $link->prepare("INSERT INTO registration_table(`user name`,`password`,`email`,`phonenum`)VALUES (?,?,?,?)");
$stmt->bind_param('ssss', '$user_name', '$password', '$email', '$phonenumt');
/* execute prepared statement */
$stmt->execute();
printf("%d Row inserted.\n", $stmt->affected_rows);
阅读空格创建问题列名用户名
在backtick中使用它。最好使用bind prepare语句
$stmt = $link->prepare("INSERT INTO registration_table(`user name`,`password`,`email`,`phonenum`)VALUES (?,?,?,?)");
$stmt->bind_param('ssss', '$user_name', '$password', '$email', '$phonenumt');
/* execute prepared statement */
$stmt->execute();
printf("%d Row inserted.\n", $stmt->affected_rows);
阅读您正在使用一个双名字段用户名
检查是否有正确的sintax
如果你有相反的单词,用backstik
$sql="INSERT INTO registration_table(username,password,email,phonenum)
VALUES ('$user_name','`$password`','$email','$phonenum')";
您正在使用一个双名字段用户名
检查是否有正确的sintax
如果你有相反的单词,用backstik
$sql="INSERT INTO registration_table(username,password,email,phonenum)
VALUES ('$user_name','`$password`','$email','$phonenum')";
MySQL中的列通常不能包含空格。如果user name
不仅仅是一个输入错误,您应该使用倒勾来转义:
$sql="INSERT INTO registration_table(`user name`,password,email,phonenum)VALUES ('$user_name','$password','$email','$phonenum')";
# Here-------------------------------^---------^
强制注释:
在SQL语句中使用字符串替换会使您的代码容易受到SQL注入攻击。您应该仔细查看。MySQL中的列通常不能包含空格。如果用户名
不仅仅是一个拼写错误,您应该使用倒勾来转义:
$sql="INSERT INTO registration_table(`user name`,password,email,phonenum)VALUES ('$user_name','$password','$email','$phonenum')";
# Here-------------------------------^---------^
强制注释:
在SQL语句中使用字符串替换会使您的代码容易受到SQL注入攻击。您应该仔细查看。密码是一个保留关键字。在“用户名”列中使用空格。另外,请注意,您的代码对SQL注入是开放的。您应该使用准备好的语句或至少转义输入。Password是一个保留关键字。列名称中的空格用户名
在backtick中使用它。还请注意,您的代码对sql注入是开放的。您应该使用准备好的语句,或者至少转义输入。因此,对于您有价值的答案,它比您有价值的答案更有效