MySQL表内共有3个数据
账号 密码 邮箱
查询到有输入邮箱地址就返回Flase,否则返回True
一直try失败!求大佬指教
数据库表代码如下
try:
create_sqil="create table uid_info (uid varchar(18),password varchar(18),mail varchar(30));"
cur.execute(create_sqil)
except Exception as e:
print('创建数据表失败!')
else:
print('创建数据表成功!')
cur.close()
代码如下
def data_regist_mail(email):
sql = "SELECT * FROM uid_info \
WHERE mail = %s" % (email)
try:
cur.execute(sql)
data = cur.fetchall()
print(data)
if data != None:
print('email已返回True')
return 'True'
else:
for row in data:
Uid = row[0]
Password = row[1]
email = row[2]
print("Uid=%s,Password=%s,mail=%s" % (Uid, Password, email))
return 'UID_FLASE'
except:
print("Regist_mail:Error: unable to fecth data")
cur.close()
使用形参传递邮箱地址,传递的是string类型,使用tkinter输入!
报错:Regist_mail:Error: unable to fecth data