So i am working on a program that is and I am stuck.
I have a login and signup system that saves new signups in a mysql database.
At the start of the program I take the passwords and names and put them together in a tuple.
Then i put that tuple in a list.
If i wanna login it cant check a tuple in that list.
Here is my code:
Login:
def login():
userKnown = input("Hallo, heeft u al een account? y/n ")
if userKnown == "y":
user = input("username: ")
passw = input("password: ")
userjoin = (user,passw)
if userjoin in bigdata:
print("login succesful")
else:
print("try again")
UploadData:
def uploadData():
print("Bezig met uploaden.")
mycursor.execute("SELECT name, password FROM userData")
data = mycursor.fetchall()
bigdata.append(data)
print("Upload worked. n")
I hope someone can help me.
A fix to the login system.
3
Answers
I solved it thanks to Georg Richter.
I used the Where function in select and that worked
Here is the code:
I think the error is that bigdata does not exist into your
login
function.Try this:
def login(bigdata)
and call the function in this way:login(bigdata)
Try using try block to find the user its easier this way.
SELECT has a WHERE clause where you can specify user and password to optimize your application.