$User = M("User"); // 实例化User对象
$condition['name'] = 'thinkphp';
$condition['status'] = 1;
// 把查询条件传入查询方法
$User->where($condition)->select();
最后生成的SQL语句是
- SELECT * FROM think_user WHERE `name`='thinkphp' AND status=1
$User = M("User"); // 实例化User对象
$condition['name'] = 'thinkphp';
$condition['account'] = 'thinkphp';
$condition['_logic'] = 'OR';
// 把查询条件传入查询方法
$User->where($condition)->select();
最后生成的SQL语句是
- SELECT * FROM think_user WHERE `name`='thinkphp' OR `account`='thinkphp'