sql ошибка добавления записи

node js

function registration(req,res){
   let body = '';
   req.on('data',chunk =>{
   body += chunk.toString();
   let info_post = parse(body);
const connection = mysql.createConnection({
   host: 'localhost',
   user: 'root',
   database: 'login',
   password: ''
});
let sql = `INSERT INTO user_info (login, password, email) VALUES (${info_post.login} , ${info_post.password}, ${info_post.email})`;
console.log(sql)
connection.connect(function(err){
   if(err)return console.error("Ошибка: " + err.message);
})
connection.query(sql, function(err, results) {
   if(err) console.log(err);
});     
connection.end(function(err) {
      if (err) {
           return console.log("Ошибка: " + err.message);
         }
      console.log("Подключение с БД закрыто");
   });  
});

при добавлении 3 параметра возникает ошибка:

  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlState: '42000',
  sqlMessage: "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 '@eer)' at line 1"

как это исправить? В бд стоит email - varchar


Ответы (0 шт):