<?php

class Instructor_model extends CI_Model
{

    public function login($username,$password)
    {
        //$this->load->databse;
        $this->db->where('uname',$username);
        $this->db->where('pword',$password);
        
        $result=$this->db->get('instructor');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->id;
        }
        else
        {
            return false;
        }
    }

    public function validate_username_email($username,$email)
    {
        //$this->load->databse;
        $this->db->where('uname',$username);
        $this->db->where('email',$email);
        
        $result=$this->db->get('instructor');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->email;
        }
        else
        {
            return false;
        }
    }

    public function retrive_password($username,$email)
    {
        //$this->load->databse;
        $this->db->where('uname',$username);
        $this->db->where('email',$email);
        
        $result=$this->db->get('instructor');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->pword;
        }
        else
        {
            return false;
        }
    }

    public function retrive_fname($username,$password)
    {
        //$this->load->databse;
        $this->db->where('uname',$username);
        $this->db->where('pword',$password);
        
        $result=$this->db->get('instructor');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->fname;
        }
        else
        {
            return false;
        }
    }


    public function retrive_lname($username,$password)
    {
        //$this->load->databse;
        $this->db->where('uname',$username);
        $this->db->where('pword',$password);
        
        $result=$this->db->get('instructor');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->lname;
        }
        else
        {
            return false;
        }
    }

    public function retrive_email($username,$password)
    {
        //$this->load->databse;
        $this->db->where('uname',$username);
        $this->db->where('pword',$password);
        
        $result=$this->db->get('instructor');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->email;
        }
        else
        {
            return false;
        }
    }


}