0

I use a package mysql for the NodeJS for working the MySQL.
I want to check the data. I write next a query and then save it in declared variable:

SELECT username, email FROM `Users` WHERE `username` = ' + user.username + 'AND `email` = ' + user.email + ') 

and below an object which should be add in my the DB:

const user = {
 'username': username,
 'password': bcrypt.hashSync(password, bcrypt.genSaltSync(8), null),
 'email': req.body.email
};

But, I get an error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`email` = example@gmail.com)' at line 1

Please, tell to me when I made the error or the errors.

Aleksei Korkoza
  • 427
  • 7
  • 22

0 Answers0