Реализация ORM, Sequelize или использование
connection.query('INSERT INTO staff (name, hours) VALUES (?, ?)', [YourVar,YourSecondVar], function (error, results, fields) {
// error will be an Error if one occurred during the query
// results will contain the results of the query
// fields will contain information about the returned results fields (if any)
});
или
connection.query({
sql: 'INSERT INTO staff (name, hours) VALUES (?, ?)',
timeout: 40000, // 40s
values: [varOne,varTwo]
}, function (error, results, fields) {
// error will be an Error if one occurred during the query
// results will contain the results of the query
// fields will contain information about the returned results fields (if any)
});