我在这样的表中有一个字段,
我有这样的代码
public function get_data_promocode($db) {
$date = date('Y-m-d H:i:s');
$this->db->from($db);
$this->db->where('promo_start >=', date('Y-m-d 00:00:00',strtotime($date)));
$this->db->where('promo_end <=', date('Y-m-d 23:59:59',strtotime($date)));
$this->db->where('promo_count IS NULL', null, false);
$this->db->order_by('promo_id DESC');
$query = $this->db->get();
return $query->result();
}
如何显示当前日期介于promo_start和promo_end之间的促销数据?
答案 0 :(得分:0)
获取您的promo_start_date和promo_end_date并将这些变量与您的方法一起传递
$this->db->where("promo_end >= '" . $promo_start_date . "' AND promo_start <= '" . $promo_end_date . "'")