本文整理汇总了PHP中Pager::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::query方法的具体用法?PHP Pager::query怎么用?PHP Pager::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
header('Content-Type: text/html; charset=utf-8');
include 'islogin.php';
include '../common/db.php';
include '../common/Pager.pdo.class.php';
include '../common/util.php';
if (isset($_GET['id'])) {
mysql_query('delete from dfdyyspx_xxbm where xxbm_id=' . $_GET['id'], $conn);
}
if (isset($_POST['delall'])) {
$ids = implode(',', $_POST['delall']);
$del = "delete from dfdyyspx_xxbm where xxbm_id in ({$ids})";
mysql_query($del, $conn);
}
$currpage = isset($_GET['p']) ? $_GET['p'] : 1;
$pager = new Pager($pdo, 'dfdyyspx_xxbm', 'xxbm_id desc', "1=1", 10, $currpage, '*');
$result = $pager->query();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>欢迎光临-河南艺术培训基地-官方网站-后台管理系统Ver1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="index.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
function init(){
var h = $(document).height()-50;
$("#imiddle").css("height",h);
示例2:
<div id="imiddle_center">
<table style="margin-top:5px" bgcolor="#999999" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
<tr>
<th width="5%" height="35" bgcolor="#F3F3F3">ID</th>
<th width="25%" height="35" bgcolor="#F3F3F3">标题</th>
<th width="25%" bgcolor="#F3F3F3">内容</th>
<th width="25%" bgcolor="#F3F3F3">图片效果</th>
<th width="5%" bgcolor="#F3F3F3">查看次数</th>
<th width="10%" bgcolor="#F3F3F3">操作</th>
</tr>
<?php
$i = 0;
$color = "#FbFbFb";
foreach ($pager->query() as $v) {
if (++$i % 2 == 0) {
$color = '#FFFFFF';
} else {
$color = '#FBFBFB';
}
?>
<tr bgcolor="<?php
echo $color;
?>
" onmouseover="this.bgColor='#fcf9cd'" onmouseout="this.bgColor='<?php
echo $color;
?>
'">
<td align="center"><?php
echo $v[0];
示例3: myadm_shorten
loader_import('saf.Misc.TableHeader');
if (!isset($cgi->offset)) {
$cgi->offset = 0;
}
$pg = new Pager($cgi->offset);
$pg->url = site_current() . '?table=' . urlencode($cgi->table) . '&orderBy=' . urlencode($cgi->orderBy) . '&sort=' . urlencode($cgi->sort);
// build query
$sql = 'select * from ' . $cgi->table;
if ($cgi->orderBy) {
$sql .= ' order by ' . $cgi->orderBy;
if ($cgi->sort) {
$sql .= ' ' . $cgi->sort;
}
}
// execute
$res = $pg->query($sql);
if ($res === false) {
die($pg->error);
}
$tbl = db_table($cgi->table);
$tbl->getInfo();
foreach ($tbl->info as $key) {
$key = (array) $key;
$key = array_shift($key);
$headers[] = new TableHeader($key, ucwords(str_replace('_', ' ', $key)));
}
function myadm_shorten($value)
{
if (strlen($value) > 32) {
$value = htmlentities(substr($value, 0, 29)) . '...';
} elseif (empty($value)) {