0

I had a working project uploaded to server 2 week before. It was working fine until now. Below is code for model awsmodel.php

class Awsmodel extends MY_Model {

    function __construct()
    {

    }
    // some other functions
}

MY_Model again extends to CI_model.

class MY_Model extends CI_Model {
// required functions
}

From controller pages.php I am calling the function like below.

class Pages extends MY_Controller {
  public function index()
    {
        $data = $this->allCommonMenu();
        $this->load->model('Awsmodel');
        $data['featured'] = $this->Awsmodel->featuredProp();
        $this->load->view('home_pz',$data);
    }
 }

The above code suddenly stooped working today. After some test and tries, I got to know that when I comment below 2 lines from controller function then The page loads.

  $this->load->model('Awsmodel');
  $data['featured'] = $this->Awsmodel->featuredProp();

I have changed environment variable to 'development' and tested but still no error message shows. In firefox its showing a blank page, where as in chrome it shows 500 server error. The same code was working since 2 weeks. Don't know why its not working now. If anyone can help me out ?
I am using CI version 2.1.4

4
  • Which version of CI you use??? Commented Nov 24, 2015 at 6:14
  • you can also check your Apache error log for error!! Commented Nov 24, 2015 at 6:16
  • @Saty Sorry my mistake - its CI version 2.1.4 Commented Nov 24, 2015 at 6:49
  • set display_errors value 'On' in your php.ini and set log_threshold = 4 ,log_path = 'application/logs/' in your CI config.php to get error on page Commented Nov 24, 2015 at 6:58

1 Answer 1

3

If you using CI 3.0 please load model like this

class Pages extends MY_Controller {
  public function index()
    {
        $data = $this->allCommonMenu();
        $this->load->model('awsmodel'); //as your model filename: awsmodel.php
        $data['featured'] = $this->Awsmodel->featuredProp();
        //$data['featured'] = $this->awsmodel->featuredProp();// for  CI version 2.1.4 –
        $this->load->view('home_pz',$data);
    }
 }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.