Files
2026-06-13 16:02:07 +10:00

87 lines
2.4 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ModelHdd extends CI_Model {
public function create($table, $data, $batch = false)
{
if($batch === false){
$insert = $this->db->insert($table, $data);
}else{
$insert = $this->db->insert_batch($table, $data);
}
return $insert;
}
public function update($table, $data, $pk, $id = null, $batch = false)
{
if($batch === false){
$insert = $this->db->update($table, $data, array($pk => $id));
}else{
$insert = $this->db->update_batch($table, $data, $pk);
}
return $insert;
}
public function delete($table, $data, $pk)
{
$this->db->where_in($pk, $data);
return $this->db->delete($table);
}
public function getDataHdd($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('hdd');
}else{
$this->db->select('*');
$this->db->from('hdd');
$this->db->where(['ID_HDD' => $id]);
}
return $this->db->get()->result_array();
}
public function getDataHddPC($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('hdd');
$this->db->where('TYPE_HDD="SATA"');
}
return $this->db->get()->result_array();
}
public function getDataHddNB($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('hdd');
$this->db->where('TYPE_HDD="SATA" AND DIMENSI_HDD="2,5 Inch"');
}
return $this->db->get()->result_array();
}
public function getDataHddAIO($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('hdd');
$this->db->where('TYPE_HDD="SATA" AND DIMENSI_HDD="2,5 Inch"');
$this->db->or_where('TYPE_HDD="SATA" AND DIMENSI_HDD="3,5 Inch"');
}
return $this->db->get()->result_array();
}
public function getDataHddWS($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('hdd');
}
return $this->db->get()->result_array();
}
public function getDataHddSRV($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('hdd');
}
return $this->db->get()->result_array();
}
}
?>