I'm using SQLite3 I have a columns but the error says that column "undefined" is not created.
const SQLite = require('sqlite3').verbose();
const db = new SQLite.Database('./database.sqlite');
db.serialize(function() {
db.run(`INSERT INTO users (id, name, soul, money, level, exp, items, weapon,
armor, inbattle) VALUES(${message.author.id}, ${message.author.name},
"determination", 0, 1, 0, "DogFood", "Stick", "Bandage", "False");`);
})
events.js:183 throw er; // Unhandled 'error' event
Error: SQLITE_ERROR: no such column: undefined
I'm using SQLite3 I have a columns but the error says that column "undefined" is not created.
const SQLite = require('sqlite3').verbose();
const db = new SQLite.Database('./database.sqlite');
db.serialize(function() {
db.run(`INSERT INTO users (id, name, soul, money, level, exp, items, weapon,
armor, inbattle) VALUES(${message.author.id}, ${message.author.name},
"determination", 0, 1, 0, "DogFood", "Stick", "Bandage", "False");`);
})
events.js:183 throw er; // Unhandled 'error' event
Error: SQLITE_ERROR: no such column: undefined
Share Improve this question edited Oct 5, 2018 at 22:01 ifbamoq asked Oct 5, 2018 at 21:52 ifbamoqifbamoq 4471 gold badge5 silver badges17 bronze badges1 Answer
Reset to default 2The fix of another error was adding the "" to ${message.author.username}. Final code:
const SQLite = require('sqlite3').verbose();
const db = new SQLite.Database('./database.sqlite');
db.serialize(function() {
db.run(`INSERT INTO users (id, name, soul, money, level, exp, items, weapon,
armor, inbattle) VALUES("${message.author.id}", "${message.author.username}",
"determination", 0, 1, 0, "DogFood", "Stick", "Bandage", "False");`);
})
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745355896a4624115.html
评论列表(0条)