method to implement the paging function.
See examples and tutorials are on a single table operation, but in many cases we need to use multiple table joint operations. What should we do at this time, such as a multiple table joint query? thinkphp has considered this problem, and has been very thoughtful to help us arrange the associated query and associated operations. I don't have much trouble with this! In fact, the flexible use of the framework of some of the basic function methods, you can reach the associated query and associated operations. There's no need to remember a whole bunch of crap.
Data paging is often used in a function, TP this aspect to do quite simple. Find a tutorial on the Internet ( http://bbs.phpchina.com/thread-52813-1-1.html ), I thought that reference to this tutorial to write a TP paging program should be very simple. I didn't think it was quite a struggle!
① First encountered Fatal error: Class ' don't found in .... the error prompted a generalist on the internet to know is missing an extended class library. Later downloaded the corresponding file on the official website.
② Extended Class Library There is no hint of error, but still can not correctly show the desired results! View page Trace information , originally SQL have problems SELECT COUNT () as Tp_count from ' Think_demo ' LIMIT 1 , the analysis concludes this sentence of the $count = $test->count (', ' id ') the code has a problem, changed to $count = $test->count (' ID ') finally saw the hyperlink to the next page of the previous page. Do not book as much as you believe!
③ Tutorial $list = $test->findall (', $fields, ' Id desc ', $p->firstrow. ', '. $p-> ListRows); This code doesn't get the results I want, and I don't want to go into the details of how the various parameters of the FindAll method are used. It is then changed to $list = $test->query ("Select $fields think_demo ORDER BY id desc limit $p->firstrow, $p->listrows" ) . Run again, this time finally put the paging out!