0
I already checked and all my calls are correct. The code ran on Windows and transferred it to Ubuntu. After the transfer gives this error:
An Error Was Encountered
Unable to locate the model you have specified: crudmodel
The model in question (crudModel.php):
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class CrudModel extends CI_Model {
public function __construct()
{
parent::__construct();
}
public function add($tabela= NULL, $dados= NULL){
if ($this->db->insert($tabela, $dados)){
return TRUE;
}
else{
return FALSE;
}
}
public function delete($tabela= NULL, $dados= NULL){
$this->db->where('id', $dados);
if ($this->db->delete($tabela)){
return TRUE;
}
else return FALSE;
}
public function read($tabela= NULL){
$result= $this->db->get($tabela);
return $result;
}
public function buscaDados($tabela= NULL, $dados= NULL){
if ($tabela!= NULL && $dados!= NULL){
$this->db->where('id', $dados);
if ($this->db->update($tabela)){
return TRUE;
}
else return FALSE;
}
else return FALSE;
}
public function update($tabela= NULL, $dados= NULL){
if ($tabela!= NULL && $dados!= NULL){
return $result= $this->db->get_where($tabela, $dados);
}
else return FALSE;
}
}
From what I’ve seen, the problem is the autoload... but I don’t know how to hit it.
Autoload:
$autoload['packages'] = array();
$autoload['libraries'] = array('form_validation', 'session', 'database', 'table', );
$autoload['helper'] = array('url', 'form', 'html', 'file', );
$autoload['model'] = array('crudModel', 'sessionModel', );
Call example of model class method:
$dados= $this->crudModel->buscaDados('usuario',$dados);
Son, we need data, codes to analyze before we can give an answer. I don’t know about the others, but I missed the divination chairs in college (although my clients also ignore that!). = D
– Dennis Braga
I wonder if there is any reason that might cause this error... something related to the core of codeigniter, if you needed code analysis posted the same in the question.
– Away
Dude, path! It was in windows, and you switched to Linux. Inclusion of real path, bars (windows uses
\
, already linux uses/
)... as I said, there are many possibilities. Post the codes, from inclusion to standard paths. It is more accurate to help you.– Dennis Braga
Information is really lacking
– Luiz Picolo
@Away, edit your question and ask the IC version.
– rray
Put the autoload, mah! Put it where you include it. Everything, so we know what it is!
– Dennis Braga
@Away the class name shouldn’t be
Crudmodel
instead ofcrudModel
?– rray
The class name is Crudmodel, following the rule of having the first letter of the upper class name, now the file name and its calls have the first letter in Lower.
– Away