Php 类型:ArgumentCountError消息:参数太少,无法正常工作
帮帮我。。我收到错误类型:ArgumentCountError消息:参数太少,无法使用函数M\u students::get\u edit()我想显示mysql表中的所有条目,但一直收到错误消息。我是Codeigniter的新手,不知道如何解决这个问题 我的模型Php 类型:ArgumentCountError消息:参数太少,无法正常工作,php,mysql,codeigniter,Php,Mysql,Codeigniter,帮帮我。。我收到错误类型:ArgumentCountError消息:参数太少,无法使用函数M\u students::get\u edit()我想显示mysql表中的所有条目,但一直收到错误消息。我是Codeigniter的新手,不知道如何解决这个问题 我的模型 <?php defined('BASEPATH') OR exit('No direct script access allowed'); class M_students extends CI_Model { pub
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class M_students extends CI_Model {
public function __construct()
{
parent::__construct();
}
private static $table = 'students';
private static $pk = 's_id';
public function get_edit($data, $s_id)
{
return $this->db->set($data)->where(self::$pk, $s_id)->update(self::$table);
}
}
您没有向模型函数
get_edit()
提供所需的参数,但只向$where
提供了一个参数
$data['student'] = $this->m_students->get_edit($where);
而在名为$data
的数组调用名为edit()
的模型函数后,根据问题中提供的代码,有两个参数不存在
$this->m_students->edit($data, $u_id);
您应该只调用
get\u edit($data,$u id)
,在$data
之后有两个参数,您需要将两个参数传递给函数$data['student']=$this->m\u students->get\u edit($where)代码>这里只有一个。
$this->m_students->edit($data, $u_id);