MIF_E31222680/application/models/Prestasi_santri_model.php

42 lines
1.1 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Prestasi_santri_model extends CI_Model
{
public function get_data($table)
{
return $this->db->get($table);
}
public function insert_data($data, $table)
{
$this->db->insert($table, $data);
}
public function get_prestasi_by_santri($id_santri)
{
return $this->db->get_where('tb_prestasi_santri', ['id_santri' => $id_santri])->result();
}
public function update_data($data, $table)
{
$this->db->where('id_prestasi_santri', $data['id_prestasi_santri']);
$this->db->update($table, $data);
}
public function get_filtered_data($start = null, $end = null)
{
if (!empty($start) && !empty($end)) {
$this->db->where('tanggal >=', $start);
$this->db->where('tanggal <=', $end);
}
return $this->db->get('tb_prestasi_santri')->result();
}
public function delete($where, $table)
{
$this->db->where($where);
$this->db->delete($table);
}
}