site/views/index.php
<?php foreach($pic as $pic_item): ?> {
<img src="<?php echo base_url('assets1/images/slider/'.$pic_item->pic_item );?>">
}
<?php endforeach;
?>
controllers/Cspages.php
public function index()
{
$this->load->model('gallery_model');
$pic_unique_id = 18; // slider
$data['pic'] = $this->gallery_model->get_picture($pic_unique_id);
$this->load->view('index', $data);
}
models/Gallery_model.php
public function get_picture($pic_unique_id)
{
$query = $this->db->get_where('galleries_pictures', array('picture_unique_id' => $pic_unique_id));
return $query->result();
}
How to fix the following error?
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$pic_item
Filename: views/index.php
Line Number: 214
Backtrace:
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\site\views\index.php Line: 214 Function: _error_handler
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\site\controllers\Cspages.php Line: 31 Function: view
File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\index.php Line: 315 Function: require_once