while running the codeigniter I have a following error:
A PHP Error was encountered Severity: Notice Message: Undefined property: Social::$social_model Filename: controllers/social.php Line Number: 10
Whats wrong with my code any help please?
controllers/social.php
class Social extends CI_Controller {
public function index(){
$data = array();
$this->load->view('header.php');
$this->load->view('staffs/content.php');
if ($query = $this-> social_model -> get_records()) // **[line 10]**
{
$data['records'] = $query;
}
$this->load->view('social/content.php', $data);
$this->load->view('footer.php');
}
// ....
}
models/social_model.php
<?php
class social_model extends CI_Model{
function get_records()
{
$query = $this->db->get('admins');
return $query -> result();
}
// ....
}
您必须加载模型:
$this->load->model('social_model');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.