Codeigniter Model Error: Undefined Property

codeigniter model error: Undefined property

You have to load the db library first. In autoload.php add :

$autoload['libraries'] = array('database');

Also, try renaming User model class for "User_model".

Undefined property error when using model

It says that your Model is not loaded. You can fix this by changing name of below method

public function __login()

to

public function __construct()

This way it will be automatically called when your class is called and your Model will be automatically loaded.

PHP CodeIgniter Error: Undefined Property: Model

You have to ensure that you are loading the model which you can do in the your controllers constructor or in the method itself that is using it, by using $this->load->model('m_login');

And refer to it as ...

public function CheckPassword()
{
$output = $this->m_Login->get_login($this->input->post('InputUsername'),$this->input->post('InputPassword'));
print_r($output);
// More code here
}

See how that flies for you!

CodeIgniter Undefined property when I call the function model

answer the question.

I had to create the object, because to import the model codeigniter not create the instance the object.

$this->load->model('usuario_model');
$usuario = new usuario_model();

$perfil_usuario = $usuario->obtener_usuario($username);

this way I could access to function of model.

If somebody have a best answer, pliss comment, thanks

Regards

Undefined property PHP error on Codeigniter

You have to make changes in your model function that must return a "result" that you can easily use in your view. So just replace

return $query

with

return $query->result()

Or make a change in your foreach loop in views from

foreach($get_ztable as $row)

to

foreach($get_ztable->result() as $row)

Codeigniter model shows Undefined property error on helper

The CI Instance should created with reference.

$CI = &get_instance();

Edit:

You did mistake in your model.

class   Project extends CI_Model {  // you should extend model not controller


Related Topics



Leave a reply



Submit