使用Codeigniter计算特定月份的全部

I am currently doing an e-commerce system. I would like to monitor how many people bought to the specific product in that month.. For example I am selling earphones, 5 people bought earphones for the month of January,Feb and so on.

Question: Is it possible to split the mm in my stored value in my table?

NOTE: I used the datepicker in html(the format of datepicker in html is yyyy-mm-dd)

CONTROLLER

$data['products'] = $this->CrudModel->count_all('products','date');
print_r($data['products']);die;

MODEL

public function count_all($table,$date)
{
    $this->db->select('product_name');
    $this->db->from($table);
    $this->db->where(array('date' => '$date' )); // What should I put here? So that I can fetch the date starting January until December
    $num_results = $this->db->count_all_results();
}

COLUMNS of my PRODUCT Table

'event_id' 'full_name' 'email' 'date' 'contact'

Try below code.

$this->db->where('date >=', $start_date);
$this->db->where('date <=', $end_date);

or you can also try

$where = "DATE(date) BETWEEN '2017-01-01' AND '2017-02-01'";

You can use group by like below

public function count_all($table,$date)
{
    $this->db->select('product_name');
    $this->db->from($table);
    $this->db->where('date >=', $start_date);
    $this->db->where('date <=', $end_date);
    $this->db->order_by('date','desc');
    $this->db->group_by('MONTH(date), YEAR(date)');
    $num_results = $this->db->count_all_results();
}