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

Hi, recently I start seeing Model error in logs. It happens rarely but I wanted to know reason.
Error saying:
ERROR - 2018-02-05 13:57:26 --> Severity: error –> Exception: /public_html/application/models/Car_model.php exists, but doesn't declare class Car_model /public_html/system/core/Loader.php 336

My Car_model.php:
PHP Code:
<?php if (!defined('BASEPATH'))  exit('No direct script access allowed');


class 
Car_model extends CI_Model 
starts this way.

What might cousing this error?
Reply
#2

Are you just loading the Model in a controller or are you auto loading it?

If it's in a controller try loading it in the controllers __constructor.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 02-06-2018, 08:42 PM by dave friend.)

You're saying this happens intermittently? In other words, sometimes the class loads, but sometimes it won't?
Reply
#4

(This post was last modified: 02-06-2018, 08:08 AM by neuron.)

I am loading it in MY_Controller.

yes Dave it happens intermittently 

PHP Code:
class MY_Controller extends CI_Controller {

    public function 
__construct() {

        
parent::__construct();
        
$this->load->model('utility_model');
        
$this->load->model('blogs_model');
        
$this->load->model('car_model');
}

Reply
#5

(This post was last modified: 02-06-2018, 10:21 AM by InsiteFX.)

If your going to load it in the MY_Controller you might as well autoload them.

I would load them in the Controllers that use them.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB