select a query that does not run in codeigniter?


I am trying to execute select query in codeigniter and i create function for the same like below:

public function validate(){
    $username = $this->security->xss_clean($this->input->post('username'));
    $password = $this->security->xss_clean($this->input->post('password1'));
    $type = $this->security->xss_clean($this->input->post('utype'));

    $this->db->where('email', $username);
    $this->db->where('password', $password);
    $this->db->where('utype', $type);

    // Run the query
    $query = $this->db->get();

    // Let's check if there are any results
    if($query->num_rows == 1)
        // If there is a user, then create session data
        $row = $query->row();
        $data = array(
                'userid' => $row->id,
                'fname' => $row->fname,
                'lname' => $row->lname,
                'email' => $row->email,
                'utype' =>$row->utype,
                'phone' =>$row->mobile,
                'city' =>$row->city,
                'state' =>$row->state,
                'country' =>$row->country,
                'validated' => true
       echo '<pre>';print_r($data); exit();
        //return true;
        echo "OPPS some error";
        //return false;

it is always showing opps some error, even i am enter correct username and password. why select query not run? i have did wrong something. please help me.

You are used :

if($query->num_rows == 1)

Correction is like bellow :

if($query->num_rows() == 1)