新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
/时间短查询
创新互联公司是专业的加格达奇网站建设公司,加格达奇接单;提供成都网站设计、成都网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行加格达奇网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
$starttime=GetMkTime($starttime);
$endtime=GetMkTime($endtime);
if($issettime==1){
if(!empty($starttime) !empty($endtime)){
$wheresql .=" AND paidan_time BETWEEN $starttime AND ".$endtime."";
}else if(!empty($starttime) empty($endtime)){
$endtime=time();
$wheresql .=" AND paidan_time BETWEEN $starttime AND ".$endtime."";
}else if(empty($starttime) !empty($endtime)){
$starttime=GetMkTime("2012-1-1");
$wheresql .=" AND paidan_time BETWEEN $starttime AND ".$endtime."";
}
}else if($issettime==2){
if(!empty($starttime) !empty($endtime)){
$wheresql .=" AND shousu_time BETWEEN $starttime AND ".$endtime."";
}else if(!empty($starttime) empty($endtime)){
$endtime=time();
$wheresql .=" AND shousu_time BETWEEN $starttime AND ".$endtime."";
}else if(empty($starttime) !empty($endtime)){
$starttime=GetMkTime("2012-1-1");
$$wheresql .=" AND shousu_time BETWEEN $starttime AND ".$endtime."";
}
}else
{
if(!empty($starttime)){
if($isset=="jr"){
$starttime=GetDateMK($starttime);
$wheresql .=" AND datediff('".$starttime."',FROM_UNIXTIME(`paidan_time`))=0 ";
}else{
//$endtime=time();
$wheresql .=" AND paidan_time BETWEEN $starttime AND ".$endtime."";
}
/*$nowtime = time();
$passtime=$nowtime-$starttime;
$tianshu=floor($passtime/(24*60*60));
echo floor($passtime/(24*60*60)); //天数
//echo 'br/';
$starttime = $nowtime - ($tianshu*24*3600);
$wheresql .= " AND paidan_time='$starttime' ";*/
}
}
可以添加一个并且条件,例如myid是xxx,那么SQL语句如下:
$sql = "select * from ... where (现在的所有条件在这里并在其外添加括号) AND myid!=xxx;"
求本周的开始和结束时间
$w = date('w',time()) - 1;
$start_time = time() - $w * 60 * 60 * 24; //星期一的时间戳
$end_time = time() + (6 - $w) * 60 * 60 * 24; //星期天的时间戳
M('tablename')-where("create_time = {$start_time} and create_time = $end_time")-select();
月份的也很简单了,求出本月开始和结束的时间,然后在根据时间查询就可以了