[eluser]anyamanggar[/eluser]
for view
Code:
<?php foreach ($publication as $itemlist): ?>
<?php echo $itemlist['title'] ?>
<?php endforeach ?>
publication_model
Code:
<?php
class Publication_model extends CI_model{
function __construct()
{
parent::__construct();
}
function getall(){
$this->load->database();
$this->db->order_by('id','asc');
$query = $this->db->get('publication');
return $query->result();
}
function delete($id){
$this->load->database();
$this->db->delete('publication', array('id' => $id));
}
function retrieve() {
$this->load->database();
$this->db->order_by("id", "asc");
$query = $this->db->get('publication');
return $query;
}
function create() {
$data = array(
'title' => $this->input->post('title'),
'link' => $this->input->post('link'));
$this->db->insert('publication',$data);
}
function findById($id) {
$this->db->where('id', $id);
$query = $this->db->get('publication');
return $query->row_array();
}
function update(){
$this->load->database();
$data = array(
'title'=>$this->input->post('title'),
'link'=>$this->input->post('link'));
$this->db->where('id',$this->input->post('id'));
$this->db->update('publication',$data);
}
// ini untuk setting database list berita depan
// end of class model
}
controller
Code:
$this->load->model('publication_model');
$query = $this->publication_model->retrieve();
$data['publication'] = $query;
please help me, i have try with my code but the result is errroorr
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: title
Filename: template/home_view.php
Line Number: 40
please help me//