Im trying to make the user log in whereas if they type the correct username and password they will be able to do so but I keep getting an error when I enter the login details
def login(self):
global con
if self.txt_user.get() == "" or self.txt_pass.get() == "":
messagebox.showerror("Error", "Please fill up all fields!")
else:
try :
con=pymysql.connect(host="localhost",user="root",password="",database="employee")
cur=con.cursor()
cur.execute("select * from employeelist where username=%s",self.txt_user.get())
row=cur.rowcount
print(row)
if row != None :
cur.execute("select password from employeelist where username=%s", self.txt_pass.get())
row1 = cur.rowcount
print(row1)
if(row1 != None):
messagebox.showinfo("Success", "Login Successful", parent=self.root)
m = menu
m.Menu(root)
else:
messagebox.showerror("Error", "Wrong Password. Please try again!")
else:
messagebox.showerror("Error, Wrong Username or Password. Please try again!")
except Exception as ex:
con.close()
messagebox.showerror("Error",f"Error due to: {str(ex)}",parent=self.root)
self.txt_user.get()andself.txt_pass.get()are returning what you think they should be returning? Also, are you sure thatcur.rowcountcan returnNonerather than zero under certain circumstances?