访问tbl_person的详细信息时出错

person.php

<?php
class Person extends CI_Controller {

    public function index()
    {
        echo 'Hello World! person';

        $this->load->model('PersonModel');

        $this->PersonModel->get_last_ten_entries();
    }
}
?>

personModel.php

<?php


class PersonModel extends CI_Model {

    var $title   = '';
    var $content = '';
    var $date    = '';

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

    function get_last_ten_entries()
    {
        $query = $this->db->get('entries', 10);
        return $query->result();
    }

    function insert_entry()
    {
        $this->title   = $_POST['title']; // please read the below note
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->insert('entries', $this);
    }

    function update_entry()
    {
        $this->title   = $_POST['title'];
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->update('entries', $this, array('id' => $_POST['id']));
    }

}
?>

getting this error :

Fatal error: Call to a member function get() on a non-object in C:\wamp1\www\ci\CodeIgniter_2.1.3\application\models\personModel.php on line 18

please help to solve this error ..

A common error with CodeIgniter setups is forgetting to load the database. This document discusses how to do it:

http://ellislab.com/codeigniter/user-guide/database/connecting.html

The easiest way is to add "database" to the library array for autoloading found in application/config/autoload.php

Example:

$autoload['libraries'] = array('database', 'form_validation', 'session');