Ejemplo n.º 1
0
def select_data():
    #if request.method == 'GET':
    # user_id = str(request.args.get('id'))
    #else:
    # user_id = str(request.form["id"])

    db = Database()
    #sql_query = "SELECT * FROM inventory WHERE id = %s;" % (user_id)  #打ID只顯示撈回一筆上方if#要拿掉
    sql_query = "SELECT * FROM inventory;"  #撈回inventory全部資料要用,上面if else要#掉
    data_string = db.execute_select(sql_query)
    return render_template('main.html', result=data_string)
Ejemplo n.º 2
0
def select_data():
    #if request.method == 'GET':
    # user_id = str(request.args.get('id'))
    #else:
    # user_id = str(request.form["id"])

    db = Database()
    #sql_query = "SELECT * FROM inventory WHERE id = %s;" % (user_id)  #打ID只顯示撈回一筆上方if#要拿掉
    sql_query = "SELECT * FROM inventory;"  #撈回inventory全部資料要用,上面if else要#掉
    data_string = db.execute_select(sql_query)
    return data_string + \
           "<form method='get' action='/mysql'>" \
           "</br>" \
           "<button type='submit'>回mysql頁面</button></form>"