Traceback (most recent call last):
File "D:\python\pdf.py", line 36, in
main()
File "D:\python\pdf.py", line 35, in main
tea()
File "D:\python\pdf.py", line 26, in tea
sql.execute('UPDATE users SET cash = cash + 100 WHERE login = ?',(ulogin, ))
sqlite3.OperationalError: no such column: login
Вот код:
import sqlite3
global db
global sql
db = sqlite3.connect('pdftea.db')
sql = db.cursor()
sql.execute("""CREATE TABLE IF NOT EXISTS users (
login TEXT,
cash INT
)""")
db.commit()
def tea():
global ulogin
ulogin = "Sergey"
number = input("Сколько грамм: ")
if number == '40':
sql.execute('UPDATE users SET cash = cash + 40 WHERE login = ?',(ulogin, ))
print('Ваш баланс повышен на 40')
db.commit()
if number == '100':
print('Ваш баланс повышен на 100')
sql.execute('UPDATE users SET cash = cash + 100 WHERE login = ?',(ulogin, ))
db.commit()
def enter():
for i in sql.execute('SELECT cash FROM users'):
print("Ваш баланс" + i)
db.commit()
def main():
enter()
tea()
main()