thinkphp encounters ranking and paging problems when querying

WBOY
Release: 2016-08-04 09:20:41
Original
1067 people have browsed it

When querying data associated with two tables, the ranking will be affected by the paging page. Ranking will only be performed on the current page. How to solve this problem? thinkphp encounters ranking and paging problems when querying

thinkphp encounters ranking and paging problems when querying

thinkphp encounters ranking and paging problems when querying

Reply content:

When querying data associated with two tables, the ranking will be affected by the paging page. Ranking will only be performed on the current page. How to solve this problem? thinkphp encounters ranking and paging problems when querying

thinkphp encounters ranking and paging problems when querying

thinkphp encounters ranking and paging problems when querying

The total_bean field is added to the oc_member table and updated at any time.

Create a view. Since the SQL statement is complex and TP does not support it well, the complex SQL is made into a view, simplifying the SQL statement executed in TP, and then querying the view in TP to obtain the results
$Model=D("BlogView" );
$Model->where($where)->page($page,$end)->select();

Related labels:
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