(01-25-2018, 01:58 PM)pbarney Wrote: Can you show the code? What CI version?
Hi,
Below is the sample code. When I try to display all the parameter using "echo" it is displaying but these are able to pass stored processor. Could you please suggest me to resolve this.
Thank you..
Ajax:
$.ajax({
url:base_url +"staff/update_single_staff",
dataType:"text",
data:new FormData($('#form_add_staff')[0]),
method:"POST",
contentType:false,
processData:false,
success:function(data){
console.log(data);
}
});
}
Controller function:
$staff_id = $this->input->post("hdn_staff_id_unique");
//echo $str;
$college_staff_id= $this->input->post("staff_id");
$college_id= $this->session->userdata('college_id');
$first_name= $this->input->post("txt_first_name");
$last_name= $this->input->post("txt_last_name");
$father_name= $this->input->post("txt_father_name");
$mother_name= $this->input->post("txt_mother_name");
$aadhar= $this->input->post("aadhar");
$gender= $this->input->post("gender");
$date_of_birth= date('Y-m-d', strtotime($this->input->post("txt_dob")));
$qualification= $this->input->post("txt_qualification");
$designation= $this->input->post("txt_designation");
$date_of_join= date('Y-m-d', strtotime($this->input->post("txt_doj")));
$contact= $this->input->post("txt_contact");
$email= $this->input->post("txt_email");
$salary= $this->input->post("txt_salary");
$address1= $this->input->post("txt_addr1");
$address2= $this->input->post("txt_addr2");
$photo= $temp_image;
$last_modified_date = date('Y-m-d H:i

');
$this->load->model("staff_model");
$result = $this->staff_model->update_single_staff($staff_id,$college_id,$college_staff_id,$first_name,$last_name,$father_name,$mother_name,$aadhar,$gender,$date_of_birth,$qualification,$designation,$date_of_join,$contact,$email,$salary,$address1,$address2,$photo,$last_modified_date);
//echo "Staf_id: ".$this->input->post("hdn_staff_id_unique");
echo json_encode($result);
Model:
function update_single_staff ($staff_id,$college_id,$college_staff_id,$first_name,$last_name,$father_name,$mother_name,$aadhar,$gender,$date_of_birth,$qualification,$designation,$date_of_join,$contact,$email,$salary,$address1,$address2,$photo,$last_modified_date){
$this->db->reconnect();
$query = $this->db->query("call update_single_staff(".$staff_id.",".$college_id.",".$college_staff_id.",`".$first_name."`,`".$last_name."`,'".$father_name."','".$mother_name."','".$aadhar."','".$gender."','".$date_of_birth."','".$qualification."','".$designation."','".$date_of_join."','".$contact."','".$email."',".$salary.",'".$address1."','".$address2."','".$photo."','".$last_modified_date."')");
return $query->result_array();
}