yourphp Basic Statement

Source: Internet
Author: User

Instantiate page code

1. Time code: {$vo. createtime|todate=###, ' y-m-d h:i:s '}

2. Connection: {: U (' Pro/arr ')} such as: <form action= "{: U (' Pro/arr ')}" name= "form" method= "POST" >

Connections in the PHP page

URL ('service-pro/arr'= URL ('service-pro/arr').' &p= ';   // 5. Define the connection

Query statement $where['status']='1';

$where['name']='Baidu'; $list= $mwhere($where),Select(); and a few other1.$where='and status =1';2.$where['Status']='1';3. $list = $mwhere('Status=1'),Select(); 4.$where['title'] = Array (' like','%'. $title.'%');

Write your own pagination code

 Publicfunction arr () {$m= M ('problem');//0. Basic conditions$pagesize ='1'; $p= $_get['P']; if(Empty ($_get['title']) {$title="'; }Else{$title= $_get['title']; }        $where['title'] = Array (' like','%'. $title.'%');//1. Query Criteria$where['Status'] ='1'; $totalNum= $mwhere($where)->count ();//2. A total of several data$totalpage = Intval ($totalNum/$pagesize);//3. Calculate pagination [Total pages]$totalp = $totalNum%$pagesize; if($totalp! =0) {$totalpage+=1; } $nowpage= $p;//4. Paging 4 Nodes "current page, previous page, next page, end"        if($p <=1) {$nowpage='1'; } $nowsize= $nowpage * $pagesize-$pagesize;//[Current number of articles]$firstpage=1; $prevpage= $nowpage-1;//[prev]        if($prevpage <=$nowpage) {$prevpage=$nowpage; } $nextpage= $nowpage +1;//[Next Page]        if($nextpage >=$totalpage) {$nextpage=$totalpage; } $lastpage= $totalpage;//[Last]$url= URL ('Service-pro/arr').'&title='. $title.'&p=';//5. Define the connection$page='<a class= "A1" > Total'. $totalNum.'Bar Current'. $nowpage.'/'. $totalpage.'page </a>'; $page.='<a href= "'. $url. $firstpage.'"> first page </a>'; $page.='<a href= "'. $url. $prevpage.'"> Prev </a>'; $page.='<a href= "'. $url. $nextpage.'"> Next </a>'; $page.='<a href= "'. $url. $lastpage.'"> Last </a>'; $list= $mwhere($where)->limit ($nowsize, $pagesize)->order ('createtime desc'),Select(); $ This->assign ('Ser_title', $title); $ This->assign ('page', $page); $ This->assign ('List', $list); $ This-display (); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.