Yii database Query method, Yii database Method _php Tutorial

Source: Internet
Author: User
Tags php framework

The query method of Yii database and Yii database method


This paper describes the query method of Yii database. Share to everyone for your reference, as follows:

Two methods of querying are described here. One is direct query, one is to use the criteria to implement the query.
Copy the Code code as follows: $user =user::model ();

1. Direct Enquiry:

$arr =array (  "Select" = "Username,password,email",//field to query  "condition" = "username like '%6 '",//query criteria  "Order" = "id desc",  "Limit" =>5,  "offset" =>1,); $info = $user->findall ($arr);

2. Use criteria:

$criteria =new Cdbcriteria (); $criteria->select= "Username,password,email"; $criteria->condition= "username Like '%1 ', $criteria->limit=5; $criteria->order= "id desc"; $criteria->offset=1; $info = $user->findall ($ criteria);

It is hoped that this article is helpful to the PHP program design based on YII framework.

Articles you may be interested in:

    • The directory structure, portal files, and routing settings for the Yii introductory tutorial
    • Yii Installation and Hello World
    • YII PHP Framework Practical Introductory Tutorial (detailed)
    • Yii Query Builder Usage Example tutorial
    • Yii uses URL components to beautify the management method
    • Yii method for removing asterisks from required fields
    • The method of Cgridview implementation in Yii for batch deletion
    • Methods of Yii Authority control (three methods)
    • Yiiframework Introductory Knowledge Point Summary (graphic tutorial)

http://www.bkjia.com/PHPjc/1085890.html www.bkjia.com true http://www.bkjia.com/PHPjc/1085890.html techarticle the Query method of Yii database and Yii database method This paper describes the query method of Yii database. Share to everyone for your reference, as follows: Here are two methods of querying. ...

  • Related Article

    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.