Does anyone know how i can get rid of this error: " Fatal error: Call to undefined method CI_Model::User_model()"
This is my user.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends CI_Controller{
function user_model(){
parent::User_model();
$this->load->model('user_model','',TRUE);
}
public function index(){
$this->login();
}
function login(){
//xss_clean doesn't work...
$this->form_validation->set_rules('username', 'Username',
'required|trim|max_length[50]');
$this->form_validation->set_rules('password', 'Password',
'required|trim|max_length[150]');
if ($this->form_validation->run() == FALSE){
$this->load->view('view_login');
}
else{
}
}
}
?>
This is the user_model.php
<?php
class User_model extends CI_Model {
function user_model(){
parent::User_model();
}
function check_login($username, $password){
$sha1_password = sha1($password);
$query_str = "SELECT user_id FROM users WHERE username = ? and
password = ?";
$result = $this->db->query($query_str, array($username,
$sha1_password));
if ($result->num_rows() == 1){
return $result->row(0)->user_id;
}
else{
return false;
}
}
}
?>
This is my autoload:$autoload['model'] = array('User_model');
I am new to codeigniter and I was following a tutorial, in the video everything went fine, but I get errors ofcrs. Maybe it's an easy answer, but I couldn't get it.