小编Ars*_*ran的帖子

PHP 分页 - 下一个/上一个按钮

我正在尝试学习 PHP 分页。到目前为止,我可以对数字进行分页,但是上一个/下一个按钮出现在每个页码的左侧和右侧,如下所示

这是我用来生成分页的代码:

    <!DOCTYPE html>
<html lang="en">
<head>
  <title>PHP</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>List Of Customers</h2>

<div class="row">   

    <a href="add.php" class="btn btn-success">Create</a>

  <table class="table table-bordered">
    <thead>
      <tr>
        <th>Name</th>
        <th>Last Name</th>
        <th>Address</th>
        <th>Phone</th>
        <th>Email</th>
        <th>Action</th>  
      </tr>
    </thead>
    <tbody>


<?php

include 'db.php';


$link = db_connect();



$limit = 4; 


    if (isset($_GET["page"] )) 
        {
        $page  = $_GET["page"]; 
        } 
    else 
       {
        $page=1; 
       };  

$record_index= ($page-1) * $limit;      






 $sql = …
Run Code Online (Sandbox Code Playgroud)

php pagination

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

pagination ×1

php ×1