Original: thinkphp Study 11
I. Common and consistent operation
1.where
Help us set query criteria
2.order
Sort the results
$arr = $m->order (' id desc ')->select ();
$arr = $m->order (array (' id ' = ' desc ', ' sex ' = ' asc '))->select ();
3.limit
Limit results
Limit (2,5)
Limit (' 2,5 ')
Limit (//limit) (0,10)
4.field
Set query fields
Field (' username as Name,id ')
Field (Array (' username ' = ' name ', ' ID ')
Field (' id ', true)//Get all fields except ID
5.table
6.group
7.having
Second, supplementary
Alias is used to define the aliases string for the current data table
Page is used to query paging (internally converted to limit) strings and numbers
Join* for join support strings and arrays for queries
Union* used to support strings, arrays, and objects for the Union of Queries
Distinct distinct support for querying Boolean values
Lock mechanism Boolean value for the database
Cache supports multiple parameters for query caching (later described in detail in the cache section)
Relation for associative queries (requires associated model extension support) strings
Validate for data auto-validation arrays
Auto for data auto-complete array
Filter for data filtering strings
scope* for naming range strings, arrays
Thinkphp Study 11