thinkphp implements fuzzy query and paging functions
$data = M("datainfo");
$projectsname = I('get.projectsname');//Fuzzy query field submitted by the front desk
// Query conditions
$where = "";
empty($projectsname)?($where=""):($where="status=1 and projectsname like '%".$projectsname."%' or projectsname like '%".$projectsname."' or projectsname like '".$projectsname."%'");
$count = $data->where($where)->count(); // Query the total number of records that meet the requirements
$Page = new Page($count, 50); // Instantiate the paging class and pass in the total number of records and the number of records displayed on each page (50)
// Configure the display page of the front page
$Page->setConfig('header', 'Total %TOTAL_ROW% items');
$Page->setConfig('first', 'Homepage');
$Page->setConfig('last', 'Total %TOTAL_PAGE% pages');
$Page->setConfig('prev', 'Previous page');
$Page->setConfig('next', 'next page');
$Page->setConfig('link', 'indexpagenumb'); //pagenumb will be replaced with page number
$Page->setConfig('theme', '%HEADER% %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%');
// Display output in pagination
$show = $Page->show();
// Perform paging data query. Note that the parameters of the limit method must use the attributes of the Page class
$list = $data->where($where)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select ();
$this->assign('page', $show);
$this->assign("list", $list);
NodeController.class.zip
(1.08 KB Download: 3 times)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor
