'MySQL Query in Discord.js returns "unkown"
I've improved my code a lot over the past few days but I'm finally stuck. My query is returning "unknown". I've attached the code and a screenshot of the database. I'm trying to use the discordid to pull the correspnding info from the hfuid column. I would greatly appreciate a point in the right direction (Looking for video tutorials preferably).
if (command == "hf") {
connection.connect();
connection.query("SELECT hfuid FROM cleaamwd_hfbot.users WHERE discorduid = 242037588586659850", function(err, rows) {
message.reply(rows);
connection.end();
})
}
Solution 1:[1]
This query would work to get the date from the cell you need
if (command === "hf") {
connection.connect();
connection.query("SELECT * FROM cleaamwd_hfbot.users WHERE discorduid = '242037588586659850'", (err, rows) {
if (err) throw err;
const hfuid = rows[0].hfuid
message.reply(hfuid);
})
connection.end();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gh0st |