ThinkPHP有变量的where条件分页实例_php实例

WBOY
Release: 2016-06-07 17:15:41
Original
757 people have browsed it

本文实例讲述了ThinkPHP有变量的where条件分页的实现方法。分享给大家供大家参考。

主要功能代码如下:

复制代码 代码如下:

$Form= D('Announcement');
import("ORG.Util.Page");
$count = $Form->count();    //计算总数
$p = new Page ( $count, 5 );
$map = array();// 使用索引数组或者对象来作为查询条件,使用对象方式和使用数组方式的条件效果是相同的,并且是可以互换的。
$map['user_id']=$_SESSION['loginUserId'];  //
$list=$Form->limit($p->firstRow.','.$p->listRows)->order('announcement_id desc')->where($map)->findAll();  //分页语句写法  where直接运用
//dump($Form->getLastSql()); //打印出sql语句
$page = $p->show ();        //分页映射

希望本文所述对大家的PHP程序设计有所帮助。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template