Welcome Guest, Not a member yet? Register   Sign In
Loading Model
#1

[eluser]Unknown[/eluser]
I got a view and I'm trying to retrieve some data from a model, executing the following lines:

Quote:$this->load->model('clientes_model');
$data = $this->clientes_model->getCliente(1);

But I'm getting the follow message.

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$vendedores_model

Filename: views/template.php

Line Number: 3


If I load another model, works fine:

Quote:$this->load->model('pedidos_model');
$data = $this->pedidos_model->getPedido(1);

Actually this is the only model that is loaded normally, any other I try, I get the message.


Here's my model (example):

Quote:class Clientes_model extends CI_Model{

function getClient($id){

return 'exampleClient'.$id

}
}


Quote:class Pedidos_model extends CI_Model{

function getPedido($id){

return 'examplePedido'.$id

}
}


Somebody can help me with this?
Both models are declared exactly alike.
#2

[eluser]Aken[/eluser]
You don't want to load and retrieve data from your models in your view. That's what your controller is for.




Theme © iAndrew 2016 - Forum software by © MyBB