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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:16:33+00:00 2026-06-12T22:16:33+00:00

Now I am learning Codeigniter. I have more databases, so I choosed this time

  • 0

Now I am learning Codeigniter. I have more databases, so I choosed this time Anketa one.
Why is error :

**Fatal error: Call to a member function query() on a non-object in /var/www/domains/svastara/application/controllers/anketa.php on line 12** ???

I chacked, the user and pass in database is ok, database is loaded in conf, and chacked the table name. So what more?

$this->db = $this->load->database('anketa');

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

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

        }return $data;

        $this->load->view('anketa_nova', $data);
  • 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-12T22:16:35+00:00Added an answer on June 12, 2026 at 10:16 pm

    Below line doesn’t return you database object until you pass second argument as TRUE

    Change:

    $this->db = $this->load->database('anketa');
    

    To

    $newdb = $this->load->database('anketa',TRUE);
    
    $q = $newdb->query("SELECT * FROM anketaip");
    

    Reference Link: http://codeigniter.com/user_guide/database/connecting.html

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

Sidebar

Related Questions

I'm just learning MVC3 now and this is really confusing me. I have a
I have spent some time now learning reshape2 and plyr but I still do
I have been interested in learning Rails for some time now and feel now
I came from PHP language(codeigniter), but now I learning ASP.Net MVC :) In PHP
I have committed to learning C now, I'm good with Python/PHP/Bash but I've decided
I'm learning scheme and until now have been using guile. I'm really just learning
I am learning DirectX 11 right now, and was trying out one of the
I've just started learning CodeIgniter, and I'm following this authentication tutorial by nettuts+. I
I have been progressing through Learn Prolog Now! as self-study and am now learning
I'm now learning a bit of MATLAB and I have two versions of it.

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.