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->c 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.
The above describes the Yii database query method, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.