75 lines
1.6 KiB
PHP
75 lines
1.6 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Mhome extends CI_Model {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
function index(){
|
|
|
|
}
|
|
|
|
function tampil_data_keseluruhan($namatabel) //gunakan ini untuk menampilkan tabel yg lebih spesifik 'where'
|
|
{
|
|
$this->db->select("*");
|
|
$this->db->from($namatabel);
|
|
|
|
$query = $this->db->get();
|
|
return $query;
|
|
}
|
|
|
|
function tampil_data_where($namatabel,$array) //gunakan ini untuk menampilkan tabel yg lebih spesifik 'where'
|
|
{
|
|
$this->db->select("*");
|
|
$this->db->from($namatabel);
|
|
$this->db->where($array);
|
|
// $this->db->limit(1);
|
|
$query = $this->db->get();
|
|
return $query;
|
|
}
|
|
|
|
|
|
function insert($namatabel,$array)
|
|
{
|
|
return $this->db->insert($namatabel,$array);
|
|
}
|
|
|
|
function update($table,$array,$array_condition)
|
|
{
|
|
$this->db->where($array);
|
|
$this->db->update($table, $array_condition);
|
|
}
|
|
|
|
function like($namatabel,$field,$like,$kategori)
|
|
{
|
|
if ($kategori == '') {
|
|
$this->db->select("*");
|
|
$this->db->from($namatabel);
|
|
$this->db->like($field, $like, 'both');
|
|
// $this->db->limit(1);
|
|
$query = $this->db->get();
|
|
return $query;
|
|
}else{
|
|
$this->db->select("*");
|
|
$this->db->from($namatabel);
|
|
$this->db->where(array('kategori'=>$kategori));
|
|
$this->db->like($field, $like, 'both');
|
|
// $this->db->limit(1);
|
|
$query = $this->db->get();
|
|
return $query;
|
|
}
|
|
}
|
|
|
|
|
|
function produksi_kecamatan($kecamatan)
|
|
{
|
|
$query = $this->db->query("SELECT * FROM tb_lahan a join tb_data_produksi_lahan b on a.id_lahan = b.no_lahan where a.kecamatan = $kecamatan");
|
|
return $query;
|
|
}
|
|
|
|
|
|
} |