composer @Ta | |
2019-08-05 19:14 |
<?php
header("content-type:text/html;charset=utf8");
$dns = "mysql:host=localhost;dbname=数据库";
$db = new PDO($dns,'root','root',array(PDO::ATTR_PERSISTENT));
$db -> query("set names utf-8");
//查询总条数
$count = $db -> query("selct COUNT(*) FROM seven_day") -> fetchColumn();
//当前页
$page = isset($_GET['page']) ? $_GET['page'] : 1;
//每页显示条数
$size = 2;
//总页数(尾页)
$last = ceil($count/$size);
//上一页
$prev_page = $page - 1 < 1 ? 1 : $page - 1;
//下一页
$next_page = $page + 1 > $last ? $last : $page + 1;
//偏移量
$offset = ($page - 1) * $size;
//执行sql语句
$data = $db -> query("select * from seven_day limit $offset,$size");
?>
阅:1694 | 发表于2019-08-05 19:14 |
心灵鸡汤:
      
®2019-2024 all power by Zlproject3.7
川公网安备 51192202000151号
蜀ICP备2021014921号-2
首页 #top
天合之作 曲在人意