调用未定义的方法 My_model::remove_user() Codeigniter
Call to undefined method My_model::remove_user() Codeigniter
所以我正在尝试创建一个允许用户删除他们的帐户的函数:因此我希望该函数删除数据库中与他们的个人资料等相关的所有数据。
在视图中我有这个按钮:
<a href="<?php echo base_url(); ?>profiles/remove_user" class="btn btn-raised btn-warning">Delete Account</a>
这导致我的控制器“配置文件”具有以下代码:
function remove_user()
{
$this->load->model("profiles_model");
$email = $this->session->userdata('email');
$this->profiles_model->remove_user($email);
$this->load->view('templates/header');
$this->load->view('pages/homepage');
$this->load->view('templates/footer');
}
调用我的模型 Profiles_model 具有以下代码:
function remove_user($email)
{
$this->db->where('email', $email);
$this->db->delete('profiles');
}
存储数据的table是“profiles”。
我也在使用会话来提取用户的电子邮件。
当我执行时,我收到此错误消息:“消息:调用未定义的方法 Profiles_model::remove_user()”
我不明白,因为我使用几乎相同的代码来“更新”用户数据,而且效果很好。
所以我想通了...我模型上的结束“}”标签在我试图调用的函数之上!!!!!!!!!!浪费了4天我再也回不来了
所以我正在尝试创建一个允许用户删除他们的帐户的函数:因此我希望该函数删除数据库中与他们的个人资料等相关的所有数据。
在视图中我有这个按钮:
<a href="<?php echo base_url(); ?>profiles/remove_user" class="btn btn-raised btn-warning">Delete Account</a>
这导致我的控制器“配置文件”具有以下代码:
function remove_user()
{
$this->load->model("profiles_model");
$email = $this->session->userdata('email');
$this->profiles_model->remove_user($email);
$this->load->view('templates/header');
$this->load->view('pages/homepage');
$this->load->view('templates/footer');
}
调用我的模型 Profiles_model 具有以下代码:
function remove_user($email)
{
$this->db->where('email', $email);
$this->db->delete('profiles');
}
存储数据的table是“profiles”。
我也在使用会话来提取用户的电子邮件。
当我执行时,我收到此错误消息:“消息:调用未定义的方法 Profiles_model::remove_user()”
我不明白,因为我使用几乎相同的代码来“更新”用户数据,而且效果很好。
所以我想通了...我模型上的结束“}”标签在我试图调用的函数之上!!!!!!!!!!浪费了4天我再也回不来了