[eluser]SammyO[/eluser]
I think I've searched the entire world wide web, but I can't find a solution to my problem.
I want to load a model into a library.
screen_model.php:
Code:
class Screen_model extends CI_Model {
function __construct() {
$this->load->database();
}
public function add_records($UserName, $text) {
$query = array('UserName' => $UserName, 'ContentText' => $text);
$this->db->insert('twitter', $query);
}
}
The constructor of my library has the following code:
Code:
$CI =& get_instance();
$CI->load->model('screen_model', '', TRUE);
And I want to call this model by doing:
Code:
$CI->Screen_model->add_records($screen_name, $text);
This gives me the following error:
Fatal error: Call to a member function add_records() on a non-object.
What am I doing wrong?