您的SQL语法有错误;检查与MariaDB服务器版本对应的手册,以获得正确的语法

时间:2022-04-20 15:37:38

I keep getting the error:-

我不断得到错误-

"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Password='evertonblues' Forename='Josh' Surname='Edmondson' Date of Birth='199' at line 1"

“您的SQL语法有错误;检查与MariaDB服务器版本对应的手册,找到正确的语法,在第1行使用“Password=”=“evertonblues”名=“Josh”姓=“Edmondson”生日=“199”

error when running my update query.

运行更新查询时出错。

$result = mysqli_query($con, "UPDATE Users SET Username='".$newUsername."' Password='".$newPassword."' Forename='".$newForename."' Surname='".$newSurname."' `Date of Birth`='".$newDateofBirth."'     Address='".$newAddress."' `Post Code`='".$newPostcode."' Email='".$newEmail."' `Phone Number`='".$newPhonenumber."' WHERE `User ID`='".$newUserid."';");

2 个解决方案

#1


4  

You forgot a bunch of commas:

你忘记了一些逗号:

..snip... SET Username='".$newUsername."' Password='".$newPassw
                                         ^-- and many others

#2


1  

Use query as below:

使用查询如下:

"UPDATE Users SET `Username`='".$newUsername."', `Password`='".$newPassword."', `Forename`='".$newForename."', `Surname`='".$newSurname."', `Date of Birth`='".$newDateofBirth."', `Address`='".$newAddress."', `Post Code`='".$newPostcode."', `Email`='".$newEmail."', `Phone Number`='".$newPhonenumber."' WHERE `User ID`='".$newUserid."';");

Also space in Date of Birth

还有出生日期的空间。

#1


4  

You forgot a bunch of commas:

你忘记了一些逗号:

..snip... SET Username='".$newUsername."' Password='".$newPassw
                                         ^-- and many others

#2


1  

Use query as below:

使用查询如下:

"UPDATE Users SET `Username`='".$newUsername."', `Password`='".$newPassword."', `Forename`='".$newForename."', `Surname`='".$newSurname."', `Date of Birth`='".$newDateofBirth."', `Address`='".$newAddress."', `Post Code`='".$newPostcode."', `Email`='".$newEmail."', `Phone Number`='".$newPhonenumber."' WHERE `User ID`='".$newUserid."';");

Also space in Date of Birth

还有出生日期的空间。