Okay, here I have a new error that I am dealing with:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Home::$db
Filename: core/Model.php
Line Number: 77
Backtrace:
File: C:\xampp\htdocs\ci3\application\models\page_model.php
Line: 80
Function: __get
File: C:\xampp\htdocs\ci3\application\controllers\home.php
Line: 15
Function: find_ID
File: C:\xampp\htdocs\ci3\index.php
Line: 292
Function: require_once
-----------------------------------------
An uncaught Exception was encountered
Type: Error
Message: Call to a member function select() on null
Filename: C:\xampp\htdocs\ci3\application\models\page_model.php
Line Number: 80
Backtrace:
File: C:\xampp\htdocs\ci3\application\controllers\home.php
Line: 15
Function: find_ID
File: C:\xampp\htdocs\ci3\index.php
Line: 292
Function: require_once
--------------------------------
page_model.php
PHP Code:
public function find_ID($post_ID = false)
{
$this->db->select('post.*, template.*');
$this->db->from('post');
$this->db->join('template', 'template.template_ID = post.post_template_ID', 'left');
if ($post_ID)
$this->db->where(array('post.post_type' => 'page', 'post.post_ID' => $post_ID, 'post.post_status' => 1));
else
{
$this->db->where(array('post.post_type' => 'page', 'post.post_status' => 1));
$this->db->order_by('post.post_position');
}
$this->db->limit(1);
$q = $this->db->get();
if($q->num_rows() > 0)
return $q->row();
return false;
}
line 80: $this->db->select('post.*, template.*');
controllers/home.php
PHP Code:
public function index()
{
$this->load->model('page_model');
$this->data['page_detail'] = $this->page_model->find_ID();
$this->page_model->counter($this->data['page_detail']->post_ID);
$this->data['post_list'] = $this->model->post($this->data['page_detail']->post_ID);
$this->data['gallery_list'] = $this->model->post($this->data['page_detail']->post_ID, true);
$this->load->view($this->data['page_detail']->template_name, $this->data);
}
line 15: $this->data['page_detail'] = $this->page_model->find_ID();
index.php
PHP Code:
require_once BASEPATH.'core/CodeIgniter.php';
Can you help me fix the error?
" If I looks more intelligence please increase my reputation."