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
I Have a Base64 Encoded Png, How to Write the Image to a File in PHP
How to Replace Multiple Items from a Text String in PHP
Connection Reset by Peer: Mod_Fcgid: Error Reading Data from Fastcgi Server
Reaching 100% Code Coverage with PHPunit
How Is an Array in a PHP Foreach Loop Read
Codeigniter: 404 Page Not Found on Live Server
How to Give Container as Argument to Services
Send Checkbox Value in PHP Form
Ajaxify Header Cart Items Count in Woocommerce
Get Date for Monday and Friday for the Current Week (Php)
How Do Check If a PHP Session Is Empty
Openssl Not Working on Windows, Errors 0X02001003 0X2006D080 0X0E064002
Try Catch Cannot Work with Require_Once in PHP