The query builder script in my CodeIgniter model method is failing. None of the values being passed in are being populated. What is wrong?
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');
}
Model:
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();
}
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL AND transfer_date > IS NULL AND store LIKE '%%' ESCAPE '!'' at line 3 SELECT * FROM stock_transfer WHERE transfer_date < IS NULL AND transfer_date > IS NULL AND store LIKE '%%' ESCAPE '!' Line Number: 691