I've got some code for testing here:
bot.on('message', (msg) => {
if (msg.text[3] === '#') {
bot.sendMessage(msg.chat.id, "Added to DB, thanks!", {});
connection.query('INSERT INTO botrequests (places_count, discount_count) VALUES (msg.text, msg.text)',
function (error, results, fields) {
if (error) throw error;
console.log("Success");
});
}
})
What I wanna do is to insert msg.text twice into a table botrequests in columns places_count and discount_count. Tried using ' ' and " " but this never helped. What's the right way to pass a variable into a query statement?