大家好,又见面了,我是全栈君。
查询24小时之内的数据,拼接语句
/计算24小时之内的时间戳 $startime = time(); $endtime = $startime + 86399; $where =array(); //拼接查询条件方法一 $where['b.a_time'] = array('between',array($startime,$endtime)); $where['a.u_id'] = $id; $where['a.is_read'] = 0; //方法二 //$where['b.a_time']=array('between',"startime,endtime"); //$activityone = M('joinactivity as a')->join('fh_activity as b on b.a_id = a.a_id')->where(array('a.u_id'=>$id,'a.is_read'=>0))->field('b.a_title, b.a_time, a.ja_addtime')->order('a.ja_addtime DESC')->find(); $activityone = M('joinactivity as a')->join('fh_activity as b on b.a_id = a.a_id')->where($where)->field('b.a_title, b.a_time, a.ja_addtime')->order('a.ja_addtime DESC')->find(); $num = M('joinactivity as a')->join('fh_activity as b on b.a_id = a.a_id')->where($where)->count();
转载于:https://my.oschina.net/botkenni/blog/831971
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/108674.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...