I need help solving selecting from a procedure table from MySQL in Codelgniter and loading the data into Datatable. I am new to Codelgniter, for the past few days, I have been trying to solve this.
In my Controller I tried the following:
function get_vendors_sales_detail() {
$customer = $this->input->get('customer') ? $this->input->get('custoproduct_codemer') : NULL;
$start_date = $this->input->get('start_date') ? $this->input->get('start_date') : NULL;
$end_date = $this->input->get('end_date') ? $this->input->get('end_date') : NULL;
$user = $this->input->get('user') ? $this->input->get('user') : NULL;
$this->load->library('datatables');
$this->datatables
->select("sn, date, customer_name, product_name, product_code, total_items, unit_price ")
->from('vendor03_product_sales');
if ($this->session->userdata('store_id')) {
$this->datatables->where('store_id', $this->session->userdata('store_id'));
}
$this->datatables->unset_column('id');
if($customer) { $this->datatables->where('customer_name', $customer); }
if($user) { $this->datatables->where('created_by', $user); }
if($start_date) { $this->datatables->where('date >=', $start_date); }
if($end_date) { $this->datatables->where('date <=', $end_date); }
echo $this->datatables->generate();
$this->page_construct('reports/vendors_sales_details', $this->data, $meta);
}
But in my view, I am getting an error. I have tried making a search online but could not find what I need. I need help from Codelgniter experts.