zoukankan      html  css  js  c++  java
  • PHP分页原理

    1.核心是利用mysql数据库中的limit来进行分页

    语句:select * from tbArticle where status="0003" order by sn DESC limit offset, 100;

    offSet为开始值,100为每页的限制值

    2.上一页和下一页,利用js中页面的window.location.href 来进行页面的跳转

    $(".prePage").click(function(){
    var articleStatus = getArticleStatus();
    var pageNum = getPageNum() - 1;

    if (pageNum < 1) {
    window.location.href="./getArticleList.html?articleStatus=" + articleStatus + "?pageNum=1";
    }else{
    window.location.href="./getArticleList.html?articleStatus=" + articleStatus +"?pageNum="+pageNum;
    }
    })

    $(".nextPage").click(function(){
    var articleStatus = getArticleStatus();
    var pageNum = parseInt(getPageNum()) + 1;
    window.location.href="./getArticleList.html?articleStatus=" + articleStatus +"?pageNum="+pageNum;
    })
    });

  • 相关阅读:
    [LeetCode] 240
    [LeetCode] 169
    [LeetCode] 28
    [LeetCode] 27
    [LeetCode] 14
    [LeetCode] 9
    [LeetCode] 7
    [LeetCode] 2
    数据库开发规范
    Mysql优化
  • 原文地址:https://www.cnblogs.com/wangzhao2016/p/5946652.html
Copyright © 2011-2022 走看看