未定义的属性 - Codeigniter

时间:2012-02-28 08:51:01

标签: php codeigniter

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

首先要创建一个模型

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

然后我在我的控制器中调用它

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";
    }

我也在构造函数中调用了我的模型

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

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

然而,我收到此错误,

enter image description here

2 个答案:

答案 0 :(得分:1)

我认为(在uyeOnay函数中):

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

需要:

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

答案 1 :(得分:1)

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

应该是

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