<?php
class Loginmodel extends CI_Model
{
	public function login($username, $password)
	{
		$this->db->select('username', 'password');
		$this->db->from('admin');
		$this->db->where('username', $username);
		$this->db->where('password', $password);
		
		$query = $this->db->get();
		
		if($query->num_rows() == 1){
			return true;
		}else{
			return false;
		}
	}
	
	public function getall()
	{
		$this->db->select('username, password');
		$this->db->from('admin');
		$this->db->where('username', 'admin');
		$this->db->where('id', 5);
		
		$q = $this->db->get();
		if($q->num_rows() > 0){
			foreach($q->result() as $row){
				$data[] = $row;
			}
			return $data;
		}
	}
}
?>