doumu8911
2018-08-03 06:54
浏览 362
已采纳

致命错误:未捕获的ArgumentCountError

I get this error. I created a button to update the table. When I click the button, I get an error. How to fix it?

Fatal error: Uncaught ArgumentCountError: Too few arguments to function personel::update_form(), 0 passed in C:\xampp\htdocs\warehouse\panel\system\core\CodeIgniter.php on line 360 and exactly 1 expected in C:\xampp\htdocs\warehouse\panel\application\controllers\personel.php:57 Stack trace: #0 C:\xampp\htdocs\warehouse\panel\system\core\CodeIgniter.php(360): personel->update_form() #1 C:\xampp\htdocs\warehouse\panel\index.php(202): require_once('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\warehouse\panel\application\controllers\personel.php on line 57

Fİle Name: personel.php Controller

MY CODES

 public function update_form($id){

        $where = array( "id" => $id);

        $personel = $this->Personel_model->get($where);

        $viewData["personel"] = $personel;


        $this->load->view("personel_edit");

     }

MY BUTTON CODES

 <a href="<?php echo base_url("personel/update_form"); ?>" class="btn-sm btn-warning">Update </a>

图片转代码服务由CSDN问答提供 功能建议

我收到此错误。 我创建了一个按钮来更新表格。 当我单击按钮时,出现错误。 如何解决?

致命错误:未捕获ArgumentCountError:函数personel :: update_form()的参数太少,在C:\ xampp \ htdocs \ warehouse中传递0 第360行上的\ panel \ system \ core \ CodeIgniter.php,C:\ xampp \ htdocs \ warehouse \ panel \ application \ controllers \ personel.php中预期正好1:57堆栈跟踪:#0 C:\ xampp \ htdocs \ warehouse \ panel \ system \ core \ CodeIgniter.php(360):personel-&gt; update_form()#1 C:\ xampp \ htdocs \ warehouse \ panel \ index.php(202):require_once('C:\ xampp \ htdocs ...')在第57行的C:\ xampp \ htdocs \ warehouse \ panel \ application \ controllers \ personel.php中抛出#2 {main}

Fİle名称:personel.php 控制器

我的代码

  public function update_form($ id){
 
 $ where = array(“id”=&gt; $ id); 
 
 $ personel = $ this-&gt; Personel_model-&gt; get  ($ where); 
 
 $ viewData [“personel”] = $ personel; 
 
 
 $ this-&gt; load-&gt; view(“personel  _edit“); 
 
} 
   
 
 

MY BUTTON CODES

   &lt; a href =“&lt;?php echo base_url(”personel / update_form“);  ?&gt;“class =”btn-sm btn-warning“&gt;更新&lt; / a&gt; 
   
 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyan2680 2018-08-03 07:02
    已采纳

    You must pass any ID with the button to function in the controller like this.

     <a href="<?php echo base_url("personel/update_form/".$row->id); ?>" class="btn-sm btn-warning">Update </a>
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题