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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:00:05+00:00 2026-06-17T14:00:05+00:00

I had a big portal in Codeigniter in which user can register and they

  • 0

I had a big portal in Codeigniter in which user can register and they can comment on each products, they can create their profiles, a forum ( custom made ) connected to this etc…

Also the company’s main products also stored in the same DB.

The requirements is since the products tables are mpre important than users, now its some difficult for back up and all, I mean we have to split the database into two. ie one for users and their activities and other for main products.

I am bit confused to connect 2 dbs in a single codeigniter because we have to call/fetch data from both db’s in a view / model

Any ideas ?

  • 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-17T14:00:06+00:00Added an answer on June 17, 2026 at 2:00 pm

    From here:

    http://ellislab.com/codeigniter/user-guide/general/models.html#loading


    Connecting to your Database

    When a model is loaded it does NOT connect automatically to your database. The following options for connecting are available to you:

    You can connect using the standard database methods described here, either from within your Controller class or your Model class.
    You can tell the model loading function to auto-connect by passing TRUE (boolean) via the third parameter, and connectivity settings, as defined in your database config file will be used:

    $this->load->model('Model_name', '', TRUE);
    

    You can manually pass database connectivity settings via the third parameter:

    $config['hostname'] = "localhost";
    $config['username'] = "myusername";
    $config['password'] = "mypassword";
    $config['database'] = "mydatabase";
    $config['dbdriver'] = "mysql";
    $config['dbprefix'] = "";
    $config['pconnect'] = FALSE;
    $config['db_debug'] = TRUE;
    
    $this->load->model('Model_name', '', $config);
    

    You can also setup this in config as db2 parameter and use in your controller as shortlink to the database settings.

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

Sidebar

Related Questions

I've seen this being used within big software companies where they had their own
I have a big problem. I had a configuration which worked properly till today.
I've written a program in Haskell which had to load and parse big text
I've had a big problem in some library code, which I've pinned down to
I read about Big-O Notation from here and had few questions on calculating the
I've had a few questions about MEF recently, but here's the big one --
NOTE: I had two variables with the same name... Big thanks to Stefan Birladeanu
in my system, i had to move a big javascript ajax system to seam.
Had a good read through similar topics but I can't quite a) find one
I had a big explanation of what I wanted, until I realized that 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.