[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
BACKUP C 19-12
/
XAMPP74
/
htdocs
/
lppm
/
cms
/
application
/
models
/
admin
/
[
Home
]
File: Model_category.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Model_category extends CI_Model { function get_auto_increment_id() { $sql = "SHOW TABLE STATUS LIKE 'tbl_category'"; $query = $this->db->query($sql); return $query->result_array(); } function show() { $sql = "SELECT * FROM tbl_category ORDER BY category_id ASC"; $query = $this->db->query($sql); return $query->result_array(); } function add($data) { $this->db->insert('tbl_category',$data); return $this->db->insert_id(); } function update($id,$data) { $this->db->where('category_id',$id); $this->db->update('tbl_category',$data); } function delete($id) { $this->db->where('category_id',$id); $this->db->delete('tbl_category'); } function get_category($id) { $sql = 'SELECT * FROM tbl_category WHERE category_id=?'; $query = $this->db->query($sql,array($id)); return $query->first_row('array'); } function category_check($id) { $sql = 'SELECT * FROM tbl_category WHERE category_id=?'; $query = $this->db->query($sql,array($id)); return $query->first_row('array'); } function check_news($id) { $sql = 'SELECT * FROM tbl_news WHERE category_id=?'; $query = $this->db->query($sql,array($id)); return $query->num_rows(); } }