I’m still learning codeigniter, and i’m trying to create a detail page, so when i click on the detail button on a certain item, it will redirect the user to the detail page of that item. But when i click on it, i don’t get any data. What did i do wrong??
The Controller :
public function detail($id){
$data['t_lowongan'] = $this->db->get_where('t_lowongan', array('id_lowongan'=>$id))->row_array();
$this->load->view('detail_lowongan', $data);
}
The detail view :
<div class="card-body">
<?php foreach($t_lowongan as $lowong){?>
<h5 class="card-title"><?php echo $lowong->title?></h5>
<?php }?>
</div>
2
Answers
Ok so what i did is, i create the function in the model, the function is called detail_data.
The M_lowongan :
After that i edit the controller look like this :
And it works :D
try this
and thats it!!! 😀