<?php
class Album_m extends CI_Model {
    

    function __construct()
    {        
        parent::__construct();
    }
	
	
    
    public function semua($aa, $limit)
    {
		$this->d_pas = $this->load->database('default', TRUE);
        $query = $this->d_pas->query("SELECT * FROM at_galeri_id where tenan_id='$aa' order by id DESC $limit");
        return $query->result();
    }
    
        
    public function jum_hal($aa)
    {
		$this->d_pas = $this->load->database('default', TRUE);
        $query = $this->d_pas->query("SELECT * FROM at_galeri_id where tenan_id='$aa'");
        return $query->num_rows();
    }
    
    public function simpan($galery, $aa)
    {
		$data = array('galery' => $galery, 'tenan_id' => $aa);
		$str = $this->db->insert_string('at_galeri_id', $data);
        mysql_query($str);
    }
	
	public function editsimpan($a, $galery, $aa)
    {
		$data = array('galery' => $galery, 'tenan_id' => $aa);

		$this->db->where('id', $a);
		$this->db->update('at_galeri_id', $data); 
    }
    
    	
	public function hapus($a)
    {
		$this->db->where('id', $a);
		$this->db->delete('at_galeri_id'); 
    }


}