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

  • Home
  • SEARCH
  • 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 9239023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:53:35+00:00 2026-06-18T07:53:35+00:00

index_model.php is below: <?php class index_model extends CI_Model { function __construct() { parent::__construct(); }

  • 0

index_model.php is below:

<?php
class index_model extends CI_Model {

    function __construct() {
        parent::__construct();
    }

    function getVideo()
    {
        $query = $this->db->get('videolar');
        return $query->result_array();
    }

}
?>

And index controller is below, too

<?php

class index extends CI_Controller {

        function __construct() {
            parent::__construct();
        }

        function index()
    {
                $this->load->model('index_model');
                $data['video'] = $this->index_model->getVideo();
        $this->load->view('index',$data);
    }
}
?>

When I call index controller it returns this error

Fatal error: Call to a member function get() on a non-object in
/var/www/atlet/application/models/index_model.php on line 10

I set database in autoload.php.

$autoload[‘packages’] = array(‘database’);

  • 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-18T07:53:36+00:00Added an answer on June 18, 2026 at 7:53 am

    You need to load the database in the libraries array, not the packages array:

    $autoload['libraries'] = array('database');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Model <?php class Tonguetwister extends AppModel { var $name = 'Tonguetwister'; //The Associations below
I have a callback function for CURLOPT_PROGRESSFUNCTION in codeigniter like below: class download_model extends
I want to get property name of Model class in PHP. In java I
My Zend controller is like below: public function deleteAction() { $this->_helper->layout->disableLayout(); $id = (int)$this->_request->getPost('id');
Hello my model save() function doesnt work. Magento cache turned off. My code below:
So I am trying to autoload classes in PHP; however, the __autoload() function does
I'm trying to get drop down list in Cake for below two finds by
I use codeigniter to generate JSON. This is my current structure: Model articles: <?php
I have the below ajax call. jQuery.post('index.php',{ 'option' : 'com_one', 'controller': 'product', 'task' :
I have a bootstrap file which is index.php and I only allow this page

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.