本文介绍了未定义的属性-Codeigniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试激活注册用户的帐户。

I try to activate to the registered user's account.

为此首先创建模型

function uyeOnay($registrationCode) {
    $query = "SELECT id FROM pasaj_register where activationCode = '" . $registrationCode . "'";
    $result = $this->db->query($query, $registrationCode);

    if ($result->num_rows() == 1) {
        $query = "UPDATE pasaj_register SET activated = 1 WHERE activationCode = ?";
        $this->query->query($query, $registrationCode);

        return true;
    } else {
        return false;
    }
}

然后我在控制器中将其称为

then i called it in my controller

public function kayitEmailOnay() {

        $registrationCode = $this->uri->segment(3);

        if ($registrationCode == '') {
            echo "URLde onay kodu yok";
        }


        $registrationConfirmed = $this->kayitmodel->uyeOnay($registrationCode);

        if ($registrationConfirmed)
            echo "successful";
        else
            echo "unsuccessful";
    }

我在构造函数中也称为我的模型

i also called my model in constructor

public function __construct() {
        parent::__construct();

        $this->load->model('kayitmodel');
    }

但是,我收到此错误,

推荐答案

$this->query->query($query, $registrationCode);

应该是

$this->db->query($query, $registrationCode);

这篇关于未定义的属性-Codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-30 08:10