Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:40:20+00:00 2026-06-11T21:40:20+00:00

Having a very strange issue with an error on a codeigniter site. Fatal error:

  • 0

Having a very strange issue with an error on a codeigniter site.

Fatal error: Call to undefined method Document::get_by_module()

The line of code causing this (in a controller) is:

$this->document_type->get_by_module('module1');

The constructor of the controller:

function __construct(){
    parent::__construct();
    $this->load->model('document','document_type');
}

The document_type class looks like this

class Document_type extends CI_Model {
    function Document_type () {
        parent::__construct();

    }       
    function get_by_module($prefix) {
        // code 
    }
}

The main issue I’m seeing is that it’s saying Document:: is the class, but it should be Document_type. I see no reason that it should be looking in the document class for that function.

If I remove loading of the ‘document’ class from the controller constructor, the error goes away (but other things break).

Not sure how something like that could be happening.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:40:21+00:00Added an answer on June 11, 2026 at 9:40 pm

    Looks like you are loading in the wrong model file. The line

    $this->load->model('document','document_type');
    

    means something along the lines of: Find me a model named “Document” create an instance and put under $this->document_type. (see the 4th example)

    Looks like you have a Document model so the load succeeds, but if you don’t want to rename your instance put under the $this (controller instance) you shouldn’t use the second parameter in the $this->load->model() line.

    Simply write $this->load->model('document_type');

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a very strange issue with Python's subprocess.Popen. I'm using it to call
I'm having issues with a very strange error in some code I wrote. The
I am having a strange issue. I have a very simple piece of code
Hey internets. I am having a VERY strange issue in C. I am deriving
hello fellow java developers. I'm having a very strange issue. I'm trying to read
I am having a very strange issue with stat.h At the top of my
Having a very strange issue regarding postback in ASP.NET. I have page dynamically populating
I'm having a very strange issue with a space invaders game I'm working on.
Having a very strange issue with a few creative banners. On some computers when
I'm having some troubles with displaying a graph. It's a very strange issue, because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.