[eluser]cestaz18[/eluser]
Quote: $file_data = $this->upload->data();
//$file_name = $file_data[‘file_name’];
$fields = array(
“module_name”=>$this->input->post(‘module_name’),
“slug”=>$this->input->post(‘slug’),
“icon”=>$this->input->post(‘file_name’),
“report_file_name”=>$this->input->post(‘report_file_name’),
“sql_select”=>$this->input->post(‘sql_select’),
“sql_filter”=>$this->input->post(‘sql_filter’),
“sql_order”=>$this->input->post(‘sql_order’)
);
Mr. Lab assistant ...
i try your code but i got a data zero ( 0 ) in my icon field...
the rest of my field is ok..the correct data was save correctly...
but in my icon field i got zero ( 0 )value
here's my updated code
CONTROLLER
Code:
$this->upload->do_upload();
$file_data = $this->upload->data();
$fields = array(
"module_name"=>$this->input->post('module_name'),
"slug"=>$this->input->post('slug'),
"icon"=>$this->input->post('file_name'),
"report_file_name"=>$this->input->post('report_file_name'),
"sql_select"=>$this->input->post('sql_select'),
"sql_filter"=>$this->input->post('sql_filter'),
"sql_order"=>$this->input->post('sql_order')
);
$item = $this->input->post("item");
$rows = $this->input->post("row0");
$data['item'] = $this->Reports->save($fields,$item,$rows);
$c .= 'Successfully saved item';
MODEL
Code:
function save($data,$item,$details) {
if ($item == '') {
$data['link'] = "reports/view";
$this->db->trans_start();
$this->db->insert('sec_reports', $data);
$item = $this->db->insert_id();
$this->save_detail($item,$details);
$this->db->trans_complete();
}
else {
$this->db->trans_start();
$this->db->where('module_id', $item);
$this->db->update('sec_reports', $data);
$this->save_detail($item,$details);
$this->db->trans_complete();
}
return $item;
}