if(text === 'Магазин'){
man = connection.query('SELECT * FROM `products`', function(error,results){
if(error) {throw error}
const name = results[1]['name'];
const price = results[1]['price'];
bot.sendMessage(chatId, `Продукты: \nИмя: ` + name + ` Цена: ` + price);
bot.sendMessage(chatId, results[1]['name']);
});
}
if(text === 'Магазин'){
man = connection.query('SELECT * FROM `products`', function(error,results){
if(error) {throw error}
for (let i in results) {
bot.sendMessage(chatId, `Продукты: \nИмя: ${results[i]['name']} Цена: ${results[i]['price']}`);
bot.sendMessage(chatId, results[i]['name']);
}
});
}