1.where method for and condition query
Db::table (' Think_user ')->where (' name ', ' like ', '%thinkphp ')->where (' status ', 1)->find ();
2.where method Multiple fields same condition and query
Db::table (' Think_user ')->where (' Name&title ', ' like ', '%thinkphp ')->find ();
3.whereOr method for or query
Db::table (' Think_user ')->where (' name ', ' like ', '%thinkphp ')->whereor (' title ', ' Like ', '%thinkphp ')->find ( );
4.whereOr method Multi-field or query with same condition
Db::table (' Think_user ')->where (' Name|title ', ' like ', '%thinkphp ')->find ();
The 5.where method and the Whereor method are used in complex query conditions
$result = db::table (' Think_user ')->where (function ($query) {$query->where (' id ', 1)->whereor (' id ', 2); })->whereor (function ($query) {$query->where (' name ', ' like ', ' think ')->whereor (' name ', ' like ', ' think php ');}) ->select ();
This article is from the "Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1896711
thinkphp-Query method