def insert_new(params, id): sql = "insert into user values (%s,%s,%s,%s)" db = mysqlhelper() if Isid(id): db.update(sql, params) return True else: return False
def Isname(param): sql = "select password from user where name=%s" db = mysqlhelper() rs = db.select_psword(sql, param) # print(rs) if not rs: #print("数据库中没有") return False else: #print("数据库中有") return True
def Isid(param): sql="select password from user where name=%s" db=mysqlhelper() rs=db.select_psword(sql,param) # print(rs) if not rs: return True else: return False #Isid("www") #Isid("qqqq")
from DBHelper.MysqldbHelper import mysqlhelper sql = "delete from user where name=%s" sql2 = "insert into user values (%s,%s,%s,%s)" sql3 = "select password from user where name ='asd'" db = mysqlhelper() db.update(sql2, ('qqqqqqqqqqq', 'asd', '123456', 'wqwqwqw')) print(db.select_psword(sql3)) if db.select_psword(sql3) == "asd": print("True") else: print("False") if db.select_psword(sql3)[0] == "asd": print("True2") else: print("False2") print(db.select_psword(sql3)[0]) print(db.select(sql3))
def IsPaaword(param): sql = "select password from user where name=%s" db = mysqlhelper() rs = db.select_psword(sql, param) # print(rs) return rs[0]
def update_password(params): sql = "update user set password=%s where name=%s" db=mysqlhelper() #if Isid(id): db.update(sql, params) return True