How to write thinkphp multi-condition query

Source: Internet
Author: User
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 ();



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.