'SQLlite query returns an empty tuple
I have a simple Python function to search a SQLlite3 dbase. Unfortunately, it returns an empty tuple. I suspect SELECT query to be inproper. The code:
def find_name_in_db(self, logintofind):
print("List of all Users with specified name: ")
conn = mdb.connect("users.db")
cur = conn.cursor()
cur.execute('SELECT login FROM users where login=\"{logintofind}\";')
check = cur.fetchall()
print(check)
return check[0] if check else None
The output:
Input name to find: value1
List of all Users with specified name: []
Any help is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
