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. ...