我使用一个包mysql
作为NodeJS来处理MySQL
我想查看数据。我接下来写一个查询,然后将其保存在声明的变量中:
SELECT username, email FROM `Users` WHERE `username` = ' + user.username + 'AND `email` = ' + user.email + ')
以及应该在我的数据库中添加的对象下面:
const user = {
'username': username,
'password': bcrypt.hashSync(password, bcrypt.genSaltSync(8), null),
'email': req.body.email
};
但是,我收到一个错误:
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
请在发出错误或错误时告诉我。