I am trying to search for a username in a table and subsequently find that users password and check it against input so far I have...
def check():
username = logEntry.get()
password = passEntry.get()
curs.execute("SELECT * FROM logins WHERE username = VALUES (?);", (username))
userExists = curs.fetchone()
if userExists:
curs.execute("SELECT * FROM logins WHERE password = VALUES (?);",(password))
passExists = curs.fetchone()
if passExists:
controller.show_frame(look)
else:
errorLabel.place(x=0, y=0)
logButton = tk.Button(self, text="Login", command=check)
logButton.place(x=320, y=120)
regButton = tk.Button(self, text="Registration For New Users",
command=lambda: controller.show_frame(Register))
regButton.place(x=110, y=120)
Any help or suggestions would be much appreciated :)
Updated: I am now having trouble with an error saying that column username does not exist, here is what I have so far. @antti-haapala
def check():
username = logEntry.get()
password = passEntry.get()
cursor.execute("SELECT username, password" "FROM logins WHERE username = ?",(username))
resultrow = cursor.fetchone()
if resultrow is not None:
db_username, db_password = resultrow
if username == db_username and password == db_password:
controller.show_frame(look)