当前位置: 首页>>代码示例>>PHP>>正文


PHP Pager::findPages方法代码示例

本文整理汇总了PHP中Pager::findPages方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::findPages方法的具体用法?PHP Pager::findPages怎么用?PHP Pager::findPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pager的用法示例。


在下文中一共展示了Pager::findPages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dopaging

function dopaging($sql, $numrecords = 0, $limit = 15)
{
    global $clspg;
    global $pages;
    global $num;
    $clspg = new Pager();
    $temp = mysql_query($sql) or die(mysql_error());
    $numrows = mysql_num_rows($temp);
    $start = $clspg->findStart($limit, $numrows);
    if ($numrecords == 0) {
        $pages = $clspg->findPages($numrows, $limit);
    } else {
        if ($numrows > $numrecords) {
            $pages = $clspg->findPages($numrecords, $limit);
        } else {
            $pages = $clspg->findPages($numrows, $limit);
        }
    }
    if ($numrecords == 0) {
        $sql1 = $sql . " LIMIT " . $start . ", " . $limit;
    } else {
        if ($start + $limit > $numrecords) {
            $sql1 = $sql . " LIMIT " . $start . ", " . ($numrecords - $start);
        } else {
            $sql1 = $sql . " LIMIT " . $start . ", " . $limit;
        }
    }
    return $sql1;
}
开发者ID:kevinsmasters,项目名称:purecatskillsmarketplace,代码行数:29,代码来源:functions.php

示例2: Pager

error_reporting(E_ALL ^ E_NOTICE);
session_start();
$mysqli = mysqli_connect('localhost', 'root', '', 'bookstore');
mysqli_query($mysqli, "SET NAMES 'utf8'");
$p = new Pager();
// yêu cầu giới hạn bao nhiêu dòng
$limit = 8;
// Tìm dòng bắt đầu đưa vào trang lấy được (khai báo nếu nó chưa có giá trị)
$start = $p->findStart($limit);
// Tìm tổng số dOng với câu lệnh truy vấn
if (isset($_GET["matheloai"])) {
    $query = mysqli_query($mysqli, "SELECT * FROM sach WHERE MaTheLoai = '" . $_GET["matheloai"] . "'");
    $count = mysqli_num_rows($query);
    // Tìm số trang dựa vào số dọng và số giới hạn
    $pages = $p->findPages($count, $limit);
    $sql = "SELECT s.id, s.TuaDe, s.TacGia, s.Gia, s.NhaXuatBan, s.NamXuatBan, s.MaTheLoai,s.ImgSrc, tl.TenTheLoai FROM sach s, theloai tl WHERE s.MaTheLoai = tl.MaTheLoai AND s.MaTheLoai = '" . $_GET["matheloai"] . "' limit " . $start . "," . $limit;
    $sach = "SELECT tl.TenTheLoai, count(s.MaTheLoai) from sach s, theloai tl where s.MaTheLoai = tl.MaTheLoai AND s.MaTheLoai = '" . $_GET["matheloai"] . "' group by tl.TenTheLoai";
    $kq = mysqli_query($mysqli, $sach);
    $so = mysqli_fetch_row($kq);
    $result = mysqli_query($mysqli, $sql);
    if (mysqli_num_rows($result) != 0) {
        echo "<table align='center' width='100%'>";
        echo "<tr style='color:red; font-weight:bold'; align='center' >";
        echo "<td colspan='4' style='background-image:url(../images/danhmuc.png)' height='30'><p style='color:#FFF; font-weight:bold;  text-align:center' >Sách {$so['0']} ({$so['1']} sách)  </p></td>";
        echo "</tr>";
        $stt = 0;
        while ($row = mysqli_fetch_row($result)) {
            if ($stt % 4 == 0) {
                echo "<tr>";
            }
开发者ID:loctho1995,项目名称:Web-Bookstore,代码行数:30,代码来源:ds_sach.php

示例3: getListVoucher

function getListVoucher()
{
    $p = new Pager();
    /* Show many results per page? */
    $limit = 100;
    /* Find the start depending on $_GET['page'] (declared if it's null) */
    $start = $p->findStart($limit);
    /* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
    $count = mysql_num_rows(mysql_query("SELECT * FROM wp_voucher_post"));
    /* Find the number of pages based on $count and $limit */
    $pages = $p->findPages($count, $limit);
    /* Now we use the LIMIT clause to grab a range of rows */
    $result = mysql_query("SELECT * FROM wp_voucher_post LIMIT " . $start . ", " . $limit);
    /* Now get the page list and echo it */
    $pagelist = $p->pageList($_GET['page'], $pages);
    echo $pagelist;
}
开发者ID:vanlong200880,项目名称:tmdt,代码行数:17,代码来源:voucher.php


注:本文中的Pager::findPages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。