<center id="qkqgy"><optgroup id="qkqgy"></optgroup></center>
  • <menu id="qkqgy"></menu>
    <nav id="qkqgy"></nav>
    <xmp id="qkqgy"><nav id="qkqgy"></nav>
  • <xmp id="qkqgy"><menu id="qkqgy"></menu>
    <menu id="qkqgy"><menu id="qkqgy"></menu></menu>
    <tt id="qkqgy"><tt id="qkqgy"></tt></tt>
  • import pymysql from flask import Flask, render_template, request app = Flask(
    __name__) app.debug = True @app.route('/') def home(): return render_template(
    'Order_page.html') #查詢數據以列表的形式返回查詢結果 @app.route('/Order_list', methods=['POST'])
    def Order_list(): db = pymysql.Connect( host='rm-2cs.com', port=3306, user='hai'
    , password='6', db='test', charset='utf8' ) cur = db.cursor(pymysql.cursors.
    DictCursor) if request.method == 'POST': print('request===', request) page = int
    (request.form['page']) page_size = int(request.form['page_size']) sql =
    f"""select * from order a order by add_time desc limit{page * page_size},{
    page_size} """ cur.execute(sql) result_all = cur.fetchall() print(
    "result_all======", result_all) cur.close() db.close() return render_template(
    'Order_page.html', orderlist=result_all) if __name__ == '__main__': app.run()
    模版動態加載數據
    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>訂單列表</
    title> <script> function showForm() {
    //document.getElementById("myForm").style.display = "block"; // 監聽表單提交事件
    document.getElementById("myForm").addEventListener("submit", function () { //
    提交成功后將表單隱藏 document.getElementById("myForm").style.display = "none"; //
    阻止表單的默認提交行為 }); } </script> </head> <body onload="showForm()"> <div id="myForm">
    <form action="/Order_list" method="post"> 請輸入頁碼:<input type="text" name="page"><
    br> 請輸入顯示數量:<input type="text" name="page_size"><br> <input type="submit" value=
    "提交"> </form> </div> {% if orderlist %} <table border="1"> <tr> {%for name in
    orderlist[0].keys()%}<th>{{name}}</th> {%endfor%} </tr> {%for order in
    orderlist%}<tr> {%for name, value in order.items()%} <td>{{value}}</td>
    {%endfor%}</tr> {%endfor%} </table> {% endif %} </body> </html>
    頁面顯示效果

    技術
    下載桌面版
    GitHub
    百度網盤(提取碼:draw)
    Gitee
    云服務器優惠
    阿里云優惠券
    騰訊云優惠券
    華為云優惠券
    站點信息
    問題反饋
    郵箱:ixiaoyang8@qq.com
    QQ群:766591547
    關注微信
    巨胸美乳无码人妻视频