Problem with a model in Codeigniter3

0

I can not solve this error, I was reading it is a problem of lowercase and uppercase, I do not recognize the model codeigniter 3

Model Name: Model_Usuario.php Controller Name: User.php

<?php
    defined('BASEPATH') OR exit('No direct script access allowed');

    class Usuario extends CI_Controller {
        function __construct(){
            parent::__construct();
            $this->load->model('Model_Usuario');
    }

    public function index(){
        $data['contenido'] = "usuario/index";
        $data['selPerfil'] = $this->Model_Usuario->selPerfil();
        $this->load->view("plantilla", $data);
    }
}


<?php
    defined('BASEPATH') OR exit('No direct script access allowed');

    class Model_Usuario extends CI_Model{   
        function __construct(){
            parent::__construct();
            $this->load->database();
        }

        //funcion de de select
        public function selPerfil(){
            $query = $this->db->query("Select * from perfil");
            return $query->result();
        }
 }


<h4>Crud - CI3</h4>

<?php
    print_r($selPerfil);
?>

    
asked by Javier Antonio Aguayo Aguilar 08.01.2017 в 22:42
source

1 answer

0

You must declare the class of your model is its name in lowercase, with the exception of the first letter

class User_model extends CI_Model {.....}

to which your file should be application/models/User_model.php

when loading on the controller all in lowercase

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

I do not know if it works for you trying to do this in your code

$this->load->model('model_Usuario');
    
answered by 09.01.2017 в 00:52