Trying to check if the username is exists in sqlite using python 3
This is what i've tried
checkUsername = self.c.execute("SELECT username FROM Login WHERE username = ? AND position = ?",
(username, manager))
if checkUsername != 0:
print("Wrong username and password")
else:
print("correct")
If you're using the sqlite3 module, cursor.execute doesn't return the results. You need to use cursor.fetchone() or cursor.fetchall() to get the results, which come back as a tuple or list of tuples.
Check the documentation here for some more details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.