我有一个我无法解决的问题:(
好吧,我有2个约会和2次。
我需要什么? 显示最近的记录,
我试过
start date >= date('Y-m-d') AND
finish date <= date('Y-m-d') AND
(start time) >= date('H:i:s') AND
end time <= date('H:i:s'))
order by ('finish date', 'desc');
在codeIgniter ..
中->where("start_date >= '{$today}' AND finish_date <= '{$today}'")
->where("start_time >= '{$time}' AND finish_time <= '{$time}'")
我想念的是什么?
由于
答案 0 :(得分:0)
我认为我修好了......
(start_date >= $today AND start_time <= $time) AND
(finish_date <= $today AND end_time >= $time)
嗯,这有效...
答案 1 :(得分:0)
您需要更改有效的recods查询 从
$this->select(*)->from('table')->where("start_date >= '{$today}' AND finish_date <= '{$today}'")
->where("start_time >= '{$time}' AND finish_time <= '{$time}'")
到
$this->db->query("SELECT * FROM table WHERE start_date BETWEEN {$today} AND finish_date BETWEEN {$today} AND start_time BETWWEN {$time} AND finish_time BETWWEN {$time}");
return $this->db->get()->result();