Use PHPCMS v9 Development page Use to page, found that there are no multiple Table query page, after querying the data and see the posts of netizens, coupled with their own experiments, to achieve the results of multi-table associated query paging effect
Files: model.class.php
Final public Function mylistinfo ($where = ", $countWhere, $page = 1, $pagesize = ten, $key =", $setpages = ten, $urlrule = " , $array = Array ()) {
$where = To_sqls ($where);
$this->number = $this->count ($countWhere);
$page = Max (Intval ($page), 1);
$offset = $pagesize * ($page-1);
$this->pages = pages ($this->number, $page, $pagesize, $urlrule, $array, $setpages);
$array = Array ();
if ($this->number > 0) {
$where. ' LIMIT '. $offset. ', ' $pagesize
$result = $this->query ($where, "$offset, $pagesize");
$result = $this->query ($where. ' LIMIT '. $offset. ', '. $pagesize);
return $this->fetch_array ();
} else {
return Array ();
}
}
Foreground call:
$page = isset ($_get[' page ') && Trim ($_get[' page ')? Intval ($_get[' page '): 1;
$sql = "Select A.no,a.areaname,concat (A.areano, ' (', ' b.begintime, '-', B.endtime, ') ') as Areano,a.userid,a.eventtime,a. Bookdate,a.areastatus from B6_book A,b6_subarea B where A.areano=b.areano and a.userid= ' ". $memberinfo [' USERID ']." ' and bookdate>= ' ". Date (' y-m-d ')." ' ORDER by Bookdate ";
$booklist = $this->book_db->mylistinfo ($sql, "userid =". $memberinfo [' userid ']. "' and bookdate>= '". Date (' Y-m-d '). "'", $page);
$pages = $this->book_db->pages;
PHPCMS v9 Background Multi-table query paging code