i created library file named kategori.php somehow can't load library created.
here library code:
class kategori { public function panggil_kategori($id_jenis) { $ci =& get_instance(); $ci->load->model('ticketing_model'); $idjenis = $ci->ticketing_model->getone_kategori($id_jenis); return $idjenis; } }
here controller code:
public function browse_ticketing() { $this->load->library('kategori'); $this->data['data']=$this->ticketing_model->get_all(); $this->data['body']='data_ticketing'; $this->load->view('welcome_ticketing',$this->data); }
here view code:
<table class="table table-condensed table-bordered table-hover table-striped" border="1"> <h4>open</h4> <tr> <th>no</th> <th>judul</th> <th>kategori</th> <th>prioritas</th> </tr> <?php $no = 1; foreach($data $row){ ?> <tr> <td><?php echo $no++ ?></td> <td><?php echo $row['judul'] ?></td> <td><?php echo panggil_kategori($row['id_jenis']); ?></td> <td><?php echo $row['prioritas'] ?></td> </tr> <?php } ?>
and here model code :
function getone_kategori($id_jenis) { $this->db->select('nama_jenis'); $this->db->where('id_jenis', $id_jenis); $query = $this->db->get('jenis_user'); return $query->row(); }
when try run code answer fatal error: call undefined function panggil_kategori() in c:\xampp\htdocs\helpdesk\application\views\data_ticketing.php on line 18..
panggil_kategori()
method of class kategori
. have create object of class kategori in order use it:
$mykategori = new kategori();
then
$value = $mykategori->panggil_kategori($id);
i can't see you've instantiated kategori.
Comments
Post a Comment