phpcodeigniterselectquery-builderresultset

Undefined property when trying to access column not mentioned in CodeIgniter query's SELECT clause


My validations are working okay, but after that userid and password results empty in model fit_reg_model and it results into authentication failed.

model


public function log_valid($userid, $password)
{
    $this->db->select("regID, loginCode");
    $whereCondition = $array = array(
        'regID' => $userid,
        'loginCode' => $password
    );
    $this->db->where($whereCondition);
    $this->db->from('fit_1login');
    $query = $this->db->get();

    // checking result
    echo"<pre>";
    print_r ($query->result()); exit;
    return $query->row()->countID;
    
    if ($query->num_rows()) {  
        echo"<pre>";
        print_r($query->result());
        exit;
        return $query->row()->countID;
        //return TRUE;
    } else {
        return FALSE;
    }
}

Solution

  • Try to remove

    $this->db->select("regID,loginCode");
    

    In your model to see what's happening