Answer the question
In order to leave comments, you need to log in
How to output values from database to string?
How to output all values from database to message?
if (msg.message.text.startsWith("/dostups")) {
if (await isAdmin(msg)) {
let sql = db.run('select dostuplvl, VKid from dostups')
console.log(sql.toString())
messagesend(msg.message.peer_id, 'info in console')
} else {
notmessage();
}
}
Answer the question
In order to leave comments, you need to log in
let sql = 'select dostuplvl, VKid from dostups';
db.all(sql, [], (err, rows) => {
if (err) {
throw err;
}
rows.forEach((row) => {
console.log(row)
messagesend(msg.message.peer_id, '🚫Пользователь: vk.com/id' + row.VKid + '🚫\n 🚫Уровень доступа: ' + row.dostuplvl);
});
});
1) The .run method does not return the result of the request, but an instance of the object on which it was called.
2) The .run method does not imply getting the result of the request, some kind of get / all / each is better for this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question