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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:32:17+00:00 2026-06-10T16:32:17+00:00

I have a local and a remote connection with my mysql database. The local

  • 0

I have a local and a remote connection with my mysql database. The local connection works just fine. But the remote connection, while it makes a connection, it does not return anything. I usually get the following:

Fatal error: Call to a member function result() on a non-object

I use for the remote connection the following configuration:



    $db['mydb']['hostname'] = "ip_address_of_database";
    $db['mydb']['username'] = "username";
    $db['mydb']['password'] = "password";
    $db['mydb']['database'] = "database";
    $db['mydb']['dbdriver'] = "mysql";
    $db['mydb']['dbprefix'] = "";
    $db['mydb']['pconnect'] = FALSE;
    $db['mydb']['db_debug'] = FALSE;
    $db['mydb']['cache_on'] = FALSE;
    $db['mydb']['cachedir'] = "";
    $db['mydb']['char_set'] = "utf8";
    $db['mydb']['dbcollat'] = "utf8_general_ci";

In my function that accesses the database I check if there is a connection with the remote server and then I try to retrieve data.



    $mydb = $this->load->database('mydb', TRUE);
    if (!isset($mydb->conn_id) && !is_resource($mydb->conn_id)) {
        $error = 'database is not connected';
        return $error;
    }else{
        $query = $mydb->query("SELECT * FROM database LIMIT 1;"); 
        return $query->result();            
         }

This works fine in the localhost database but not in the remote database. I allways get the error
Fatal error: Call to a member function result() on a non-object

Can you please help? What am I doing wrong? I stuck on this.

  • 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-10T16:32:19+00:00Added an answer on June 10, 2026 at 4:32 pm

    Finally, I found the solution after contacting my web hosting provider. The issue had to do with the Remote database access and their servers. The IP address exception and the domain name that I had added didn’t do the job. I had to add an internal domain name that my host was using in order the Remote database access to be allowed. I spent 2-3 hours chatting with them in order to find a solution.
    Anyway now is solved. I am posting that FYI.

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

Sidebar

Related Questions

I have just started connecting android app with php My file works very fine
I have created a local H2 database which I always opened in MySQL mode
I had trouble installing a local installation of mysql, so I have a connection
I have a system with a globally open mysql connection to the local server.
I want to update remote database from local database, I have written php script
we have a local staging server running sql server 2000 and a remote public
I have a local repository I'm working on and its remote is hosted on
I have a local topic branch that's tracking a remote branch. For the sake
Suppose you have two linked servers called Local and Remote respectively. Is there a
I have a local git repo, and I have a remote git repo. What

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.