0
0
thinkphp 我想用or 连接
在不
我想问一下
select * from table where id=2 or pid =2
夏草 15:05:10
我想得到上面的语句
我这样写
$map['id'] = '1';
$map['pid'] = '2';
$modle->where($map)->select();
得么的是 and 连起来的
我怎么写一下这个数组呢
------解决方案--------------------
我想,手册中说的很清楚了:
更改默认的逻辑判断,通过使用 _logic 定义查询逻辑
$condition['name'] = 'thinkphp';
$condition['account'] = 'thinkphp';
$condition['_logic'] = 'OR';
// 把查询条件传入查询方法
$User->where($condition)->select();
最后生成的SQL语句是
SELECT * FROM think_user WHERE `name`='thinkphp' OR `account`='thinkphp'
在不
我想问一下
select * from table where id=2 or pid =2
夏草 15:05:10
我想得到上面的语句
我这样写
$map['id'] = '1';
$map['pid'] = '2';
$modle->where($map)->select();
得么的是 and 连起来的
我怎么写一下这个数组呢
------解决方案--------------------
我想,手册中说的很清楚了:
更改默认的逻辑判断,通过使用 _logic 定义查询逻辑
$condition['name'] = 'thinkphp';
$condition['account'] = 'thinkphp';
$condition['_logic'] = 'OR';
// 把查询条件传入查询方法
$User->where($condition)->select();
最后生成的SQL语句是
SELECT * FROM think_user WHERE `name`='thinkphp' OR `account`='thinkphp'
相关文章
相关标签:
本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门AI工具
相关专题
热门下载
相关下载
精品课程
相关推荐
/
热门推荐
/
最新课程
PHP面向对象基础课程(更新中)
共12课时 | 0.6万人学习
全栈式APP开发进阶教程(前端uniapp+后端ThinkPHP框架)
共18课时 | 1.1万人学习
Thinkphp3.2细致教程 底层核心说明教程
共11课时 | 0.6万人学习
最新文章










