I am trying to use SQLITE3 to store data for my discord bot and here i need to save a number that goes up each time a command is used. Here is my code: (creating table and setting the value to 0.)
db.run("CREATE TABLE gbanCases ( number INT )")
db.run("INSERT INTO gbanCases (number) VALUES ($number)", {
$number : 0
});
Trying to see what number returns:
var caseNumber = db.run("SELECT number FROM gbanCases")
console.log(caseNumber)
The thing is that caseNumber returns me "[object Object]" and I want it to return the 0 that was setted up earlier. Please help me if you can, i'm still very new to this.
console.log({ caseNumber })and see what you get.{caseNumber: Database} caseNumber: Database {filename: 'database.sqlite', mode: 65542} [[Prototype]]: Objectdb.run()for aSELECTquery, usedb.get()ordb.all()depending on whether you want 1 row or all rows. They take a callback function that receives the results.