def user_list_select(level): if level < 5: curs = sql_init() sql = "select * " \ " from mymedicine_user " \ " where ID <> 'version' and ID <> 'admin' ORDER BY ID DESC;" curs.execute(sql) # 데이타 Fetch rows = curs.fetchall() return rows
def mylist_select(u_id): # SQL문 실행 curs = sql_init() sql = "select * " \ " from mymedicine_product " \ " where INSERT_ID='" + u_id + "' and USE_YB='Y' " # "LIMIT 100" curs.execute(sql) # 데이타 Fetch rows = curs.fetchall() # 전체 rows # print(rows[0]) # 첫번째 row: (1, '김정수', 1, '서울') # print(rows[1]) # 두번째 row: (2, '강수정', 2, '서울') return rows
def myView_select(idx): # SQL문 실행 curs = sql_init() sql = "select * " \ " from mymedicine_product " \ " where USE_YB='Y' and IDX =" + idx curs.execute(sql) # 데이타 Fetch rows = curs.fetchall() # 전체 rows # print(rows[0]) # 첫번째 row: (1, '김정수', 1, '서울') # print(rows[1]) # 두번째 row: (2, '강수정', 2, '서울') return rows
def myMedi_select(ingredient): # SQL문 실행 curs = sql_init() ingredient_replace = ingredient.replace(" ", "").replace(",", "").lower() sql = "select * " \ " from mymedicine_product " \ " where USE_YB='Y' and LOWER(replace(INGREDIENT,' ','')) LIKE '%" + ingredient_replace + "%' ORDER BY YOYUL DESC" curs.execute(sql) # 데이타 Fetch rows = curs.fetchall() # 전체 rows # print(rows[0]) # 첫번째 row: (1, '김정수', 1, '서울') # print(rows[1]) # 두번째 row: (2, '강수정', 2, '서울') return rows
def select_item_product(search_text): # SQL문 실행 curs = sql_init() sql = "select * " \ " from mymedicine_product " \ " where USE_YB='Y' and " \ "(PRODUCT like '%"+search_text+"%' or INGREDIENT like '%"+search_text+"%' or MATCH_MEDICINE like '%"+search_text+"%' ) " \ "ORDER BY PRODUCT DESC" curs.execute(sql) # 데이타 Fetch rows = curs.fetchall() # 전체 rows # print(rows[0]) # 첫번째 row: (1, '김정수', 1, '서울') # print(rows[1]) # 두번째 row: (2, '강수정', 2, '서울') return rows
def login_result(result): user_id = result['user_id'] user_pw = result['user_pw'] # SQL문 실행 curs = sql_init() sql = "select * " \ " from mymedicine_user " \ " where ID='" + user_id + "' and PWD=md5('"+user_pw+"'); " # "LIMIT 100" curs.execute(sql) rows = curs.fetchall() cnt = len(rows) if int(cnt) == 1: session['user_id'] = user_id session['user_name'] = rows[0][2] session['level'] = rows[0][3] return_txt = "login" else: return_txt = "Dot" return return_txt