first commit

This commit is contained in:
alazhar
2020-01-02 22:54:01 +07:00
commit 0e423e1115
196 changed files with 54467 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<?php
class barang_model extends CI_Model{
function get_barang_all()
{
$query=$this->db->query("SELECT * FROM barang ORDER BY id DESC");
return $query->result();
}
function get_barang_by($id){
$query=$this->db->query("SELECT * FROM barang WHERE id='$id'");
return $query->result();
}
function update_barang($id)
{
$q="SELECT * FROM barang WHERE id='$id'";
$query=$this->db->query($q);
return $query->row();
}
function simpan_update_barang($id, $nama, $harga)
{
$data = array(
'id' => $id,
'nama' => $nama,
'harga' => $harga
);
$this->db->where('id', $id);
$this->db->update('barang', $data);
}
function delete_barang($id)
{
$query=$this->db->query("DELETE FROM barang WHERE id='$id'");
}
function simpan_barang($simpan_data)
{
$this->db->insert('barang', $simpan_data);
return $this->db->affected_rows();
}
}

View File

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,69 @@
<?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 */