[英]I am getting the following error: Codeigniter 3 too few arguments error
Hi I am trying to update a record but I get this error:您好,我正在尝试更新记录,但出现此错误:
"An uncaught Exception was encountered Type: ArgumentCountError Message: Too few arguments to function Complaints::update_workplace_incident(), 0 passed"
“遇到未捕获的异常类型:ArgumentCountError 消息:太少 arguments 到 function Complaints::update_workplace_incident(),0 已通过”
controller function controller function
public function update_workplace_incident($enquiry_id)
{
$response = array();
if($enquiry_id) {
$this->form_validation->set_rules('edit_practitioner', 'Practitioner', 'trim|required');
$this->form_validation->set_error_delimiters('<p class="text-danger">','</p>');
if ($this->form_validation->run() == TRUE) {
$data = array(
'practitioner' => $this->input->post('edit_practitioner'),
);
$update = $this->model_certification->update_workplace_incident($data, $enquiry_id);
if($update == true) {
echo "
<script> alert('Success')
window.location='https://kiruidavid.co.ke/osha/auth/login'
</script>";
}
else {
echo "
<script> alert('Failed')
window.location='https://kiruidavid.co.ke/osha/auth/login'
</script>";
}
}
else {
$response['success'] = false;
foreach ($_POST as $key => $value) {
$response['messages'][$key] = form_error($key);
}
}
}
model function model function
public function update_workplace_incident($data, $enquiry_id)
{
if($data && $enquiry_id) {
$this->db->where('employer_complaint_id', $enquiry_id);
$update = $this->db->update('company_complaints', $data);
return ($update == true) ? true : false;
}
}
lets try add the.= null in first line in your controller function from this...让我们尝试在您的 controller function 的第一行中添加 .= null 从此...
public function update_workplace_incident($enquiry_id)
to this...对这个...
public function update_workplace_incident($enquiry_id != null)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.