MySQLdb rowcount Returns Nothing
Posted
by
Alec K.
on Stack Overflow
See other posts from Stack Overflow
or by Alec K.
Published on 2012-04-14T23:23:35Z
Indexed on
2012/04/14
23:30 UTC
Read the original article
Hit count: 212
I am trying to log into my table called acounts using MySQLdb in Python, but it does not work for me. I keep getting my message "Not Logged In". Here is my code:
database = MySQLdb.connect("127.0.0.1", "root", "pswd", "Kazzah")
cursor = database.cursor()
cursor.execute("SELECT * FROM Accounts WHERE Email=%s AND Password=%s", (_Email, _Password))
database.commit()
numrows = cursor.rowcount
if numrows == 1:
msg = "Logged In"
else:
msg = "Not Logged In"
cursor.close()
database.close()
What am I doing wrong? Thanks.
© Stack Overflow or respective owner