See below code:
con.query(`SELECT * FROM alltime WHERE user = '${message.author.id}'`, function (err, result, fields) {
if (err) throw err;
Object.keys(result).forEach(function (key) {
var results = result[key];
if (results.afk === 1) {
alltime = con.query(`UPDATE alltime SET afk = false, reason = NULL, afktime = NULL WHERE user="${message.author.id}"`), (err, rows) => {
if (err) throw err;
}
scores = con.query(`UPDATE scores SET afk = false, reason = NULL, afktime = NULL WHERE user="${message.author.id}"`), (err, rows) => {
if (err) throw err;
}
//Run Queries
alltime;
scores;
Is it possible to run alltime
& scores
in one query? I am maxing out connections a lot on Clear DB and looking to cut down load.
Any help will be appreciated :)
I have tried all the following answers on here but they don't seem to work. Maybe it's because i'm using JS?