我的模型。
public function get_data() {
$this->db->select('*');
$this->db->from('one_month_report');
$this->db->where('store_date BETWEEN NOW() - INTERVAL 30 DAY AND NOW()');
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
} else {
return FALSE;
}
}
试试这个:
public function get_data()
{
$this->db->select('*');
$this->db->from('one_month_report');
$this->db->where('store_date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()');
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
} else {
return array();
}
}