CodeIgniter Forums
Loading Model - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Loading Model (/thread-57029.html)

Loading Model - El Forum - 02-08-2013

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

$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:

$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.

Loading Model - El Forum - 02-08-2013

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