49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
class Data_kopi_model extends CI_model
|
|
{
|
|
public function get_all_data_kopi()
|
|
{
|
|
$this->db->select('*');
|
|
|
|
$this->db->from('data_kopi');
|
|
return $this->db->get()->result_array();
|
|
|
|
}
|
|
public function hps_data_kopi($id)
|
|
{
|
|
$this->db->where('id', $id);
|
|
$this->db->delete('data_kopi');
|
|
return $this->db->affected_rows();
|
|
}
|
|
public function add_data_kopi($tahun,$bulan,$jumlah_kopi, $jenis_kopi)
|
|
{
|
|
$data = array(
|
|
'tahun' => $tahun,
|
|
'bulan' => $bulan,
|
|
'jumlah_kopi' => $jumlah_kopi,
|
|
'jenis_kopi' => $jenis_kopi
|
|
);
|
|
|
|
return $this->db->insert('data_kopi', $data);
|
|
}
|
|
public function get_data_kopi_byid($id)
|
|
{
|
|
return $this->db->get_where('data_kopi', array('id' => $id))->row_array();
|
|
}
|
|
public function update_data_kopi($id,$jumlah_kopi,$tahun,$bulan)
|
|
{
|
|
$this->db->set('tahun',$tahun);
|
|
$this->db->set('bulan',$bulan);
|
|
$this->db->set('jumlah_kopi',$jumlah_kopi);
|
|
$this->db->where('id',$id);
|
|
return $this->db->update('data_kopi');
|
|
}
|
|
|
|
public function delete_hasil_ses($id)
|
|
{
|
|
$this->db->where('id_data_kopi', $id);
|
|
return $this->db->delete('hitung_ses');
|
|
}
|
|
|
|
|
|
} |