I want to be able to get all the information from MySQLdb using the SELECT * FROM query. I have the following 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
results = cursor.fetchall()
print numrows
for result in results:
print result
How can I make variables that hold each piece of info from result. If it result returns:
(28L, 'Name', 'Last', 'email@email.com', 'pswd', '10000')
I want to make a variable called ID and get the first part of the result which is 28L, and so forth with each other pieces of information.
Thank you!
Edit
To set the full set of data use this :
And for particular values, try indexing.