tp5.1 where 时间查询
$where_time = [];
if ($_GET['s_time'] && !isset($_GET['e_time'])){
$where_time = ['add_time','> time' , $_GET['s_time']];
$this->assign('s_time',$_GET['s_time']);
} if ($_GET['e_time'] && !isset($_GET['s_time'])){
$where_time = ['add_time','< time' , $_GET['e_time']];
$this->assign('e_time',$_GET['e_time']);
} if (isset($_GET['e_time']) && isset($_GET['s_time'])){
$where_time = ['add_time','between time' ,[$_GET['s_time'],$_GET['e_time']] ];
$this->assign('e_time',$_GET['e_time']);
$this->assign('s_time',$_GET['s_time']);
} $step = config('page_normal_count');
$model = model('Page');
$start = ($page-)*$step;
$where['is_del'] = self::NOT_DEL;
$banner = model('company'); if($this->admin_user_id != ){
$where['admin_id'] = $this->admin_user_id;
} $result_list = $banner->where($where)
->where($where_time[],$where_time[],$where_time[])
->limit($start.','.$step)
->order('top_time desc,id desc')
->select(); 基于tp5.1 基本的操作 // 大于某个时间 where('create_time', '> time', '2016-1-1');
// 小于某个时间 where('create_time', '<= time', '2016-1-1');
// 时间区间查询 where('create_time', 'between time', ['2015-1-1', '2016-1-1']);
tp5.1 where 时间查询的更多相关文章
- sql时间查询的问题
今天在做一个时间查询的时候遇到一个问题,就是获取的时间是 数据库的存储是这样的2016-10-29 12:11:40 2016-10-31 15:00:05 ... $log=M('table' ...
- mysql根据时间查询前一天数据
MySql数据库如何根据时间查询前一天的数据?本文整理了几个解决方法,有需要的朋友参考下. 本节内容:用MySql怎么根据时间查询前一天的数据. 例1: 代码示例: select * from t ...
- ThinkPHP 数据库操作(四) : 聚合查询、时间查询、高级查询
聚合查询 在应用中我们经常会用到一些统计数据,例如当前所有(或者满足某些条件)的用户数.所有用户的最大积分.用户的平均成绩等等,ThinkPHP为这些统计操作提供了一系列的内置方法,包括: 用法示例: ...
- 【Elasticsearch】ES中时间查询报错:Caused by: ElasticsearchParseException[failed to parse date field [Sun Dec 31 16:00:00 UTC 2017] with format [yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis]];
ES中时间查询报错:Caused by: ElasticsearchParseException[failed to parse date field [Sun Dec 31 16:00:00 UTC ...
- 在数据库中(Oracle),根据时间查询数据: to_date()和to_char()函数
1. to_date() 函数 1.1 格式 to_date("要转换的字符串","转换的格式") //两个参数的格式必须匹配,否则会报错.即按照第二个参数 ...
- 时间查询缺少部分数据 mvc 解决方案
前情提要: 在c# mvc EF模式下 普通的列表展示页面,采用form提交的,后台视同request对象接收,如果涉及到时间搜索的情况,经常会搞错,现在明确一下怎么做. 一:Request /// ...
- Oracle 存储过程判断语句正确写法和时间查询方法
判断语句:if 条件 then if 条件 then ************; elsif 条件 then ************; elsif 条件 then ***** ...
- SqlServer:SqlServer(xpath,字段约束,时间查询,数据文件查询及还原,压缩备份)
1.xpath --1.文档 select @data --2.任意级别是否存在price节点 select @data.exist('//price') --3.获取所有book节点 select ...
- psql的时间类型,通过时间查询
psql的时间类型,通过时间查询 psql有date/timestamp类型,date只显示年月日1999-01-08,而timestamp显示年月日时分秒 1999-01-08 09:54:03.2 ...
随机推荐
- js 面向对象之属性描述符
上回介绍了面向对象之构造器属性.这次介绍下属性描述符 遍历对象属性 let person = {name: "lisi"} for (key in person) { consol ...
- 判断变量是否不为空,函数isset()、!empty()与!is_null()的比较
转载:https://blog.csdn.net/qq_38812954/article/details/79581785 判断变量的值,尤其是判断他们是否不为空,我们有以下4种方法: if(isse ...
- PHP 根据域名和IP返回不同的内容
遇到一个好玩的事情,访问别人的IP和别人的域名返回的内容竟然不一样.突然觉得很好玩,也很好奇.自己研究了一下下,就简单写一下吧~ 一个IP和一个域名, 先讲一下公网IP没有绑定域名,但是可以通过一个没 ...
- 携程移动端案列(flex布局、背景图缩放,文字阴影)
效果图如下: <body> <div class="nav"> <div class="row"> <div clas ...
- Educational Codeforces Round 70
目录 Contest Info Solutions A. You Are Given Two Binary Strings... B. You Are Given a Decimal String.. ...
- Codevs 1227 方格取数 2(费用流)
1227 方格取数 2 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 大师 Master 查看运行结果 题目描述 Description 给出一个n*n的矩阵,每一格有一个非负整数 ...
- python踩坑记录篇,持续更新
问题1:python语法错误 错误日志如下: print(a[2]) ^IndentationError: unexpected indent [解决方案]:缩进代码错误导致,将print的缩进 ...
- 自动化运维工具pssh、pdsh、pscp
pssh命令是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的,类似pdsh,个人认为相对pdsh更为简便,使用必须在各个服务器上配置好密钥认证访问. 以下 ...
- 针对于linux初学者的学习(摘自网络端)
一. 选择适合自己的Linux发行版谈到linux的发行版本,太多了,可能谁也不能给出一个准确的数字,但是有一点是可以肯定的,linux正在变得越来越流行, 面对这么多的Linux 发行版,打算从其他 ...
- 【2018.07.30】(广度优先搜索算法/队列)学习BFS算法小记
一些BFS参考的博客: https://blog.csdn.net/ldx19980108/article/details/78641127 https://blog.csdn.net/u011437 ...