I have been trying to enter direct data to an sqlite database from user input but it only captures the first input and leaves out the rest, where could I be wrong?
Here is the code:
import sqlite3 as lite
class DataInput:
def __init__(self):
self.id = input("Enter ID: ")
self.name = input("Enter name: ")
self.price = input("Enter price: ")
running = True
a = DataInput()
con = lite.connect('kev.db')
with con:
cur = con.cursor()
cur.execute("DROP TABLE IF EXISTS cars")
cur.execute("CREATE TABLE cars(id INT, name TEXT, price INT)")
cur.execute("INSERT INTO cars VALUES(?, ?, ?)", (a.id, a.name, a.price))
while running:
DataInput()
continue