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 6058529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:36:34+00:00 2026-05-23T08:36:34+00:00

Sorry for the stupid question, but this is driving me crazy… I have test_framework.php

  • 0

Sorry for the stupid question, but this is driving me crazy…

I have test_framework.php as follows:

<?php

  class Test_framework extends CI_Controller{

    function display_test(){
      echo "loading model...";
      $this -> load -> model('test_model');
      echo "model loaded...";
    }
  }
?>

and test_model.php as follows:

<?php

class Test_model extends Model {

  function get_all(){

    $q = $this -> db -> query("SELECT * FROM users");

    foreach($q -> result() as $row)
    {
        $data[] = $row;
    }
    return $data;
  }

} 

?>    

When I go to my index.php/test_framework/display_test, I see “loading model…” but never “model loaded…”, and there are no errors (just a blank white page). What could be happening wrong here??

  • 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-05-23T08:36:34+00:00Added an answer on May 23, 2026 at 8:36 am

    Well, first of all, your class naming are wrong. Moreover, you have to extend the parent model __construct();

    Here you may set an echo to trace the loading of the model:

    class Test_model extends CI_Model {
    
    function __construct()
    {
      parent::__construct();
      echo 'Model loaded!';  // something like this
    }
    
     function get_all()
    {
    // your code here
    }
    
    
    }
    

    Edit: quoting from the manual:

    Class names must have the first letter
    capitalized with the rest of the name
    lowercase. Make sure your class
    extends the base Model class.

    The basic prototype (from the manual) is:

    class Model_name extends CI_Model {
    
        function __construct()
        {
            parent::__construct();
        }
    }
    

    If you want to record the initialization of controllers and models and so on, instead of having them echo something on your page you can enable logging in application/config.php :

    $config['log_threshold'] = 1;
    
    //  0 = Disables logging, Error logging TURNED OFF
    //  1 = Error Messages (including PHP errors)
    //  2 = Debug Messages
    //  3 = Informational Messages
    //  4 = All Messages
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im sorry if this is a stupid question but i was curious, i have
Sorry if this sounds like a really stupid question, but I need to make
Sorry if this is a stupid question but sometimes I see Easter eggs and
Sorry if this seems like a stupid question but im actually having a hard
Sorry if this is a silly and/or stupid question but... Will there ever be,
I'm really sorry. This must seem like an incredibly stupid question, but unless I
I'm fairly new to C so sorry if this is a stupid question but
Sorry, this is probably a really stupid question, but is it safe to run
Sorry guys, if this is a stupid question. I have a set of integers
Sorry if this seems like a stupid question but can't find any info on

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.