Home  >  Article  >  Backend Development  >  thinkphp encounters ranking and paging problems when querying

thinkphp encounters ranking and paging problems when querying

WBOY
WBOYOriginal
2016-08-04 09:20:411023browse

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();

Statement:
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