Home » Php » php – Data fetch between to dates in codignator

php – Data fetch between to dates in codignator

Posted by: admin February 25, 2020 Leave a comment

Questions:

this is my controller

public function stock_report()
       {

        $key= $this->input->post('Txtname');
        $date1= $this->input->post('txt_to');
        $date2= $this->input->post('Txtfrom');
        $data['filter'] = $this->transfer_model->stock_report($key,$date1,$date2);  
        $this->load->view('layout/header');
        $this->load->view('layout/nav');
        $this->load->view('stock_report',$data);
        $this->load->view('layout/footer');
    }

this is my model code

public function stock_report($key,$date1,$date2)
{

    $this->db->select("*");
    $this->db->where('transfer_date<=',$date1);
    $this->db->where('transfer_date>=',$date2);
    $this->db->like("store",$key);
    $this->db->from("stock_transfer");
    $query = $this->db->get();
    return $query->result();

}
How to&Answers: