Reputation: 91
im noob in Python and i want to connect a database(sqlite3) with my "account manager", and so i want to insert a variable in read_from_db, instead of a word. Can someone help me?
def read_from_db():
**c.execute("SELECT * FROM daten WHERE username= AND password= ")**
# data = c.fetchall()
for row in c.fetchall():
name_test = (row[0])
password_test = (row[1])
Upvotes: 1
Views: 85
Reputation: 1054
A more generic way is to use .format()
def read_from_db(p):
**c.execute("SELECT * FROM daten WHERE username={0} AND password={1}".format(user_name, password)**
# data = c.fetchall()
for row in c.fetchall():
name_test = (row[0])
password_test = (row[1])
Upvotes: 0