How to write thinkphp multi-condition query? For example, the table user, Field id, name, and nickname. Now, the multi-condition query based on name and adress, $ name and $ nickname are two conditions: or, not true. How to write? In addition, how can I write an array? For example, for $ idarray (, 3), search for three pieces of data with the id of, 3 ------ solution ---- thinkphp multi-condition query how to write
How do I write thinkphp multi-condition queries?
For example, the table user, Field id, name, and nickname. Now, the multi-condition query based on name and adress, $ name and $ nickname are two conditions: or, not true. How to write?
In addition, how can I write an array? For example, if $ id = array (, 3), search for three pieces of data whose id is, 3.
------ Solution ----------------------
1:
$ A = M ('User );
$ B = $ a-> where ("name = 'Your Name' or nickname = 'Your nickname '")-> select ();
2:
$ A = M ('user ');
$ Data ['id'] = array ('in', array (1, 2, 3 ));
$ B = $ a-> where ($ data)-> select ();