PHPCMS Multi-Table query paging, put here today and share with you. This function is written in mode.class.php and may not be conducive to escalation. Just look at the code.
/** Multi-table data based on SQL query and paging for multiple table queries * @param $sql * @param $order * @param $page * @param $pagesize * @return Unknown_type */final PU Blic function mutlilistinfo ($sql = ", $page = 1, $pagesize =, $key =", $setpages = ten, $urlrule = ", $array = array ()) {$sql = Preg_replace ('/select ([^from].*) from/i ', "SELECT count (*) as COUNT from", $sql); $this->query ($sql); $ Count = $this->db->fetch_next (), $this->number = $count [' count ']; $page = max (Intval ($page), 1); $offset = $ pagesize* ($page-1); $this->pages = pages ($this->number, $page, $pagesize, $urlrule, $array, $setpages); $r = $this- >query ($where. ' LIMIT '. $offset. ', '. $pagesize); $data =new Array (), while (($row = $this->db->fetch_next ()) = False) { $data [] = $row; } return $data;}
This paper is compiled by Programmer's life www.wfuyu.com
PHPCMS Multi-Table query paging