Hello!
I have defined a function to create a combo box to log into a database
def comboLogin():
import MySQLdb
db= MySQLdb.connect(host='localhost', user='root' , passwd='acrsci00', db='Ornithobase')
self.cursor = db.cursor()
sql = '''select Username from Users'''
self.cursor.execute(sql)
result = self.cursor.fetchall()
result2 = []
x = 0
for record in result:
for field in record:
users = str(field)
result2.append(users)
x += 1
return result2
db.close()
It should close the db connection, but when I login in another place of the class it logs in as root instead of the selected username.
try:
db= MySQLdb.connect(host='localhost', user=Username , passwd=pwd, db='Ornithobase')
self.cursor = db.cursor()
How can I solve it?
Cheers!
Dani