| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /wamp/www/sipkd_2016/application/modules/penomoran/models/ |
Upload File : |
<?php
class Penomoran_model extends CI_Model {
var $data;
var $fieldmap = array();
function __construct()
{
// Call the Model constructor
parent::__construct();
$this->_table = 'PENOMORAN';
$this->_pk = 'TIPE';
$this->fieldmap = array(
'tpl' => 'TEMPLATE'
);
}
function fill_data()
{
foreach($this->fieldmap as $key => $value){
$$key = $this->input->post($key) ? $this->input->post($key) : NULL;
if(isset($$key))
$this->data[$value] = $$key;
}
}
function get_data()
{
$result = $this->db->get('penomoran')->result_array();
return $result;
}
function update_data($id)
{
$this->fill_data();
$this->db->trans_begin();
$this->db->where($this->_pk, $id);
$this->db->update($this->_table, $this->data);
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback();
return FALSE;
}
$this->db->trans_commit();
return TRUE;
}
}