Undefined Property - Codeigniter

2019-08-04 03:43发布

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

In order to that first create a model

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

However, i get this error ,

enter image description here

2条回答
Evening l夕情丶
2楼-- · 2019-08-04 04:25

i think that (in uyeOnay function) :

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

need to be :

$this->db->query($query, $registrationCode);
查看更多
疯言疯语
3楼-- · 2019-08-04 04:38
$this->query->query($query, $registrationCode);

Should be

$this->db->query($query, $registrationCode);
查看更多
登录 后发表回答