Explanation of the order method of the ThinkPHPCURD method _ PHP Tutorial

Source: Internet
Author: User
The order method of the ThinkPHPCURD method is described in detail. The order method of the ThinkPHPCURD method is one of the coherent operation methods of the model. this method is used to sort the operation results. The specific usage is as follows: $ Model-where (status1)-order (iddes ThinkPHP CURD method's order method is one of the coherent operation methods of the Model. this method Used to sort operation results.

The usage is as follows:

$Model->where('status=1')->order('id desc')->limit(5)->select();

Note:Coherent operation methods have no sequence. you can change the call sequence before the select method is called..

Supports sorting multiple fieldsFor example:

$Model->where('status=1')->order('id desc,status')->limit(5)->select();

If the desc or asc sorting rule is not specified, the default value is asc.

If your field conflicts with the mysql keyword, we recommend that you use the array method, for example:

$Model->where('status=1')->order(array('order','id'=>'desc'))->limit(5)->select();

The order method of the http://www.bkjia.com/PHPjc/825321.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/825321.htmlTechArticleThinkPHP CURD method is one of the model's coherent operation methods, which is used to sort the operation results. The usage is as follows: $ Model-where ('status = 1')-order ('Id des...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.