php多条件查询
程序员文章站
2022-05-13 14:16:24
...
$sql="select *from think_kaoqin WHERE(1=1)"; if(!empty($uid)) { $sql .=" and uid= ".$uid; } if(!empty($time1) && empty($time2)) { $sql .=" and riqi >= '".$time1."'"; } if (!empty($time2) &&empty($time1)) { $sql .=" and riqi = '".$time1."' and riqi info=M('kaoqin')->query($sql);