S
S
stevenmackson2021-02-26 21:38:36
Python
stevenmackson, 2021-02-26 21:38:36

Error "No such column", what to do?

Error, I don't know what to do, here is the code:

import sqlite3

global db
global sql
db = sqlite3.connect('serversi.db')
sql = db.cursor()

sql.execute("""CREATE TABLE IF NOT EXISTS users (
  k INT,
  cash INT
)""")
db.commit()



def teashop():
  number = input("Сколько грамм:")
  if number == '40':
    print('Ваш баланс повышен на 40')
    sql.execute('UPDATE users SET cash = cash + 40')
    sql.execute('UPDATE users SET k = 1000')
    db.commit()
  elif number == '100':
    print("Ваш баланс повышен на 100")
    sql.execute('UPDATE users SET cash = cash + 100')
    db.commit()
  elif number == 'del':
    de = input("Сколько снять:")
    sql.execute('UPDATE users SET cash = cash - ' + de)
    print("Баланс снят на " + de)	
    db.commit() 	

def enter():
  for i in sql.execute('SELECT cash FROM users'):
    print(i)
  for u in sql.execute('SELECT k FROM users'):
    print(u)

def main():
  teashop()
  enter()
main()

Mistake:
Traceback (most recent call last):
  File "D:\python\pdf.py", line 42, in <module>
    main()
  File "D:\python\pdf.py", line 41, in main
    enter()
  File "D:\python\pdf.py", line 36, in enter
    for u in sql.execute('SELECT ware FROM users'):
sqlite3.OperationalError: no such column: ware

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LikeKey, 2021-02-27
@LikeKey

Writes that there is no such ware column in users

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question