Answer the question
In order to leave comments, you need to log in
Error table X has Y columns but Z values were supplied. How to fix?
import sqlite3
db = sqlite3.connect('Account.db')
sql = db.cursor()
sql.execute("""CREATE TABLE IF NOT EXISTS oooaaa (
id INT PRIMARY KEY,
mukaka TEXT
)""")
mukaka = '123'
sql.execute(f"SELECT mukaka FROM oooaaa WHERE mukaka = '{mukaka}'")
if sql.fetchone() is None:
sql.execute(f"INSERT INTO oooaaa VALUES (?)",(mukaka))
db.commit()
print('Мукака добавлен')
else:
print("Такой мукака уже имеется")
Answer the question
In order to leave comments, you need to log in
Your table has 2 columns. That is, you need to pass 2 parameters, and you pass 1.
You can do this:
sql.execute(f"INSERT INTO oooaaa VALUES (?,?)",('тут любой id',mukaka))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question