Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 类型:ArgumentCountError消息:参数太少,无法正常工作_Php_Mysql_Codeigniter - Fatal编程技术网

Php 类型:ArgumentCountError消息:参数太少,无法正常工作

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

帮帮我。。我收到错误类型: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 {

    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);