简体   繁体   English

我收到以下错误:Codeigniter 3 太少 arguments 错误

[英]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.

相关问题 为什么我在 Laravel 中收到此错误? 错误:-arguments 到 function Darryldecode\Cart\Cart::updateQuantityRelative() 太少 - Why I am getting this error in Laravel? Error:-Too few arguments to function Darryldecode\Cart\Cart::updateQuantityRelative() 我收到一个错误,我的 function 中有几个 arguments? - I am getting an error that I have to few arguments in my function? 在类似查询中出现错误“参数太少” - Getting error “too few arguments” in like query 我有以下错误:“类型错误:函数AlbumController :: postEdit()的参数太少,1传递,正好2预期” - I have the following error: “Type error: Too few arguments to function AlbumController::postEdit(), 1 passed and exactly 2 expected” function 错误(更新数据) CodeIgniter 的 arguments 太少 - too few arguments for function error (updating data) CodeIgniter 如何解决此 CodeIgniter 的“arguments 功能太少”错误? - How do I solve this CodeIgniter's 'Too few arguments to function' error? 我在codeigniter中遇到错误 - I am getting error in codeigniter 错误“arguments 功能太少” - Error "Too few arguments to function" Laravel 当数据库插入太少时 arguments 错误 - Laravel when db insert getting too few arguments error Codeigniter,严重性:错误 --&gt; 异常:功能参数太少,管理仪表板显示 HTTP 错误 500 - Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM