<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class User_model extends CI_Model {


// Listing


 

 

    public function user($id_key){
        $this->db->like('id', $id_key , 'both');
         $this->db->like('level', 'User');
		$this->db->order_by('id', 'ASC');
        $this->db->limit(10);
        return $this->db->get('t_user')->result();
    }
	
	public function teknisi($id_key_tek){
        $this->db->like('id', $id_key_tek , 'both');
         $this->db->like('level', 'Teknisi');
		$this->db->order_by('id', 'ASC');
        $this->db->limit(10);
        return $this->db->get('t_user')->result();
    }
	
    public function daftar($a)
       {
            $this->db->insert('t_user',$a);
       }

   public function check_user($user,$pass)
  {
    $sql = "SELECT * FROM t_user where user = ? and password = ?";
	
    $data = $this->db->query($sql, array($user,$pass));
        return ($data->result_array()) ;
  }
  
  public function lengkap ($pemilik){
        $this->db->like('pemilik', $pemilik , 'both');
		$this->db->where('status' , 'Disetujui');
        $this->db->order_by('pemilik', 'ASC');
        $this->db->limit(10);
        return $this->db->get('tb_mohon')->result();
    }
	
	 public function lengkap_rekomendasi ($pemilik){
        $this->db->like('pemilik', $pemilik , 'both');
        $this->db->order_by('pemilik', 'ASC');
        $this->db->limit(10);
        return $this->db->get('tb_temuan')->result();
    }
  function check_id_pemesanan($id_pemesanan){
   $this->db->select('id_pemesanan');
   $this->db->where('id_pemesanan',$id_pemesanan);		
   $query =$this->db->get('tb_pemesanan');
   $row = $query->row();
   if ($query->num_rows > 0){
         return $row->id_pemesanan; 
   }else{
         return "";
  }
}

 }

/* End of file User_model.php */
/* Location: ./application/models/User_model.php */