thinkphp实现对两个字段或or条件搜索
2016-01-06 11:33
459 查看
thinkphp实现对两个字段或or条件搜索
$m=D('Adstext');
$data['adstext_title']=array('like',"%{$keyword}%");
$data['id']=array('like',"%{$keyword}%");
$data['_logic'] = 'or'; //条件或
$arr=$m->where($data)->relation(true)->select();
// dump($arr);
// exit;
Adstext是数据库表,$data['_logic'] = 'or'; 是条件或的实现
$m=D('Adstext');
$data['adstext_title']=array('like',"%{$keyword}%");
$data['id']=array('like',"%{$keyword}%");
$data['_logic'] = 'or'; //条件或
$arr=$m->where($data)->relation(true)->select();
// dump($arr);
// exit;
Adstext是数据库表,$data['_logic'] = 'or'; 是条件或的实现
相关文章推荐
- 搜狗百度360市值齐跌:搜索引擎们陷入集体焦虑?
- kindeditor 批量上传 上传失败 thinkphp swfupload session
- 本人即将筹备败家日志,敬请期待!
- IE:使用搜索助手
- C++深度优先搜索的实现方法
- 基于文本的搜索
- php实现搜索一维数组元素并删除二维数组对应元素的方法
- ThinkPHP关联模型操作实例分析
- 使用Sphinx对索引进行搜索
- thinkphp3.0 模板中函数的使用
- ThinkPHP采用<volist>实现三级循环代码实例
- Thinkphp模板标签if和eq的区别和比较实例分析
- 合并ThinkPHP配置文件以消除代码冗余的实现方法
- ThinkPHP中自定义目录结构的设置方法
- ThinkPHP控制器详解
- asp 多关键词搜索的简单实现方法
- asp的SQL语句中and和or同时使用的注意事项
- C#使用foreach语句搜索数组元素的方法
- WordPress中用于获取搜索表单的PHP函数使用解析
- JavaScript中数组的排序、乱序和搜索实现代码