Database 无法更新codeigniter中的数据

Database 无法更新codeigniter中的数据,database,codeigniter,Database,Codeigniter,我无法更新数据库中的数据。这是我的密码: 控制器: public function update_contact() { sleep(1); $data['validation_error'] = ''; $this -> load -> library('form_validation'); $this -> form_validation -> set_rules('name', 'Name', 'required|max_length

我无法更新数据库中的数据。这是我的密码:

控制器:

public function update_contact()
{
    sleep(1);
    $data['validation_error'] = '';
    $this -> load -> library('form_validation');
    $this -> form_validation -> set_rules('name', 'Name', 'required|max_length[40]|callback_alpha_dash_space');
    $this -> form_validation -> set_rules('email', 'Email', 'required|max_length[40]|valid_email');
    $this -> form_validation -> set_rules('phone', 'Phone', 'required|max_length[15]|alpha_numeric');
    $this->form_validation->set_rules('cbo_list', 'Group Name', 'required');

    if ($this -> form_validation -> run() == FALSE) {
        $message = "<strong>Editing</strong> failed!";
        $this -> json_response(FALSE, $message);
    } 
    else {
        $this -> contact_model -> update($this -> input -> post('name'), $this -> input -> post('email'), $this -> input -> post('phone'), $this -> input -> post('cbo_list'), $this -> session -> userdata('uid'));
        $message = "<strong>" . $this -> input -> post('name') . "</strong> has been edited!";
        $this -> json_response(TRUE, $message);
        redirect("site/contacts"); 
    } 
}
有关附加信息:

我的联系人姓名=站点, 我的型号s name=联系方式\型号, 我的表格=联系人和组联系人,其中contacts.gid=组联系人.gid

在更新数据之前,您必须提到特定的UID(用户id)

如果我运行它,没有错误,但是我不能修改数据。
有谁能帮我吗?

参数错误:

$this -> contact_model -> update($this -> input -> post('name'), $this -> input -> post('email'), $this -> input -> post('phone'), $this -> input -> post('cbo_list'), $this -> session -> userdata('uid'));
将UID移动到第一个参数位置

$this -> contact_model -> update($this -> session -> userdata('uid'), $this -> input -> post('name'), $this -> input -> post('email'), $this -> input -> post('phone'), $this -> input -> post('cbo_list'));
或者,从以下位置更改功能:

public function update($cid, $name, $email, $phone, $cbo_list)


你的模型中有$cid、$name、$email、$phone、$cbo_list、$uid的值吗?akhil:有,但没有$cid的值。我只得到“1”。我应该怎么做才能从contacts中获取真实id?没错,参数与调用的函数不同步。谢谢,但仍然无法工作。我试过你的建议,但没有改变。现在我在程序中犯了一些错误,现在我知道我的错误在哪里了。错误消息:>更新
联系人
设置
姓名
='asdasdas',
电子邮件
='esterc234@yahoo.com“,
phone
='085777789900',
gid
='1'其中
uid
='1'和
aaaa
='1'aaaa表示cid,我的错误是无法获取cid的值,我应该使用uri段获取该值吗?或者有什么建议?谢谢。是的,你需要传递uid。jbc:是的,我不能得到我的$cid的价值。我需要清楚,谢谢。美元是多少?它是来自$this->session->userdata('uid')的uid还是其他什么?
public function update($cid, $name, $email, $phone, $cbo_list)
public function update($name, $email, $phone, $cbo_list, $cid)