69 lines
1.8 KiB
PHP
69 lines
1.8 KiB
PHP
|
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||
|
|
||
|
/**
|
||
|
* Example
|
||
|
*
|
||
|
* This is an example of a few basic user interaction methods you could use
|
||
|
* all done with a hardcoded array.
|
||
|
*
|
||
|
* @package CodeIgniter
|
||
|
* @subpackage Rest Server
|
||
|
* @category Controller
|
||
|
* @author Phil Sturgeon
|
||
|
* @link http://philsturgeon.co.uk/code/
|
||
|
*/
|
||
|
|
||
|
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
||
|
|
||
|
class Mbarang extends CI_Model
|
||
|
{
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
}
|
||
|
|
||
|
function insert($insert){
|
||
|
if($this->db->insert('barang',$insert)){
|
||
|
return TRUE;
|
||
|
}else{
|
||
|
return FALSE;
|
||
|
}
|
||
|
}
|
||
|
function update($id,$update){
|
||
|
if($this->db->update('barang',$update,'id = \''.$id.'\'')){
|
||
|
return TRUE;
|
||
|
}else{
|
||
|
return FALSE;
|
||
|
}
|
||
|
}
|
||
|
function delete($id){
|
||
|
$delete['id_file'] = $id;
|
||
|
if($this->db->delete('barang',$delete)){
|
||
|
return TRUE;
|
||
|
}else{
|
||
|
return FALSE;
|
||
|
}
|
||
|
}
|
||
|
function select($select=NULL,$awal=0,$akhir=10){
|
||
|
//if(! is_null($select))$this->db->like($select);
|
||
|
$query = $this->db->get('barang',$akhir,$awal);
|
||
|
return $query->result();
|
||
|
}
|
||
|
function view($select=NULL){
|
||
|
//if(! is_null($select))$this->db->like($select);
|
||
|
$query = $this->db->get('barang');
|
||
|
$arr = $query->result_array();
|
||
|
if($query->num_rows > 0){
|
||
|
return $arr[0];
|
||
|
}else{
|
||
|
return FALSE;
|
||
|
}
|
||
|
}
|
||
|
function penerima($idu){
|
||
|
$this->db->where('id <>',$idu);
|
||
|
$query = $this->db->get('barang');
|
||
|
return $query->result();
|
||
|
}
|
||
|
}
|
||
|
/* End of file mbarang.php */
|
||
|
/* Location: ./application/controllers/welcome.php */
|