So little code, so many major problems ...
Let's start with what you haven't seen:
SQL Injection.
Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood'
The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable;
Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x';
A perfectly valid SELECT
DROP TABLE MyTable;
A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
Then there is the
Data Protection problem.
Never store passwords in clear text - it is a major security risk. There is some information on how to do it here:
Password Storage: How to do it.[
^]
And remember: if this is web based and you have any European Union users then GDPR applies and that means you need to handle passwords as sensitive data and store them in a safe and secure manner. Text is neither of those and the fines can be .... um ... outstanding. In December 2018 a German company received a relatively low fine of €20,000 for just that.
Put the two together so I don't even have to be logged in and you've got real problems ... I can bypass your security to login as anyone, and do exactly what I like with your data.
Then ... I can create a user with the same username as any existing user provided I use a different password ...
And as the coup de gras, you expose your DB access details including login name and password in your HTML of anyone who knows how to press F12 or CTRL+U can see it - ignoring that it's hardcoded into your app so you can't test it before release without trying it out on the production DB.
And that's before we get to the problem you
have noticed!
And that's probably because your column names are also MySql reserved words so they can't be used without escape characters:
NAME
and
PASSWORD
both mean something specific to mySql already.
MySQL :: MySQL 8.0 Reference Manual :: 9.3 Keywords and Reserved Words[
^]