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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:26:21+00:00 2026-06-14T18:26:21+00:00

I had developed a application in codeigniter. I had a forum like section in

  • 0

I had developed a application in codeigniter. I had a forum like section in my application.
For that I would likes to create a separate database to that controller.

So that I can maintain the site and database very easily.
My question is possible in codeigniter to assign a database to a single controller ?

Thanks

  • 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-14T18:26:22+00:00Added an answer on June 14, 2026 at 6:26 pm

    As mentioned in manix’s answer you can pass the settings to the database library constructor.

    However what was missed is that you must specify true as the second parameter and capture the output in a variable.

    $DB1 = $this->load->database('group_one', TRUE);
    $DB2 = $this->load->database('group_two', TRUE);
    

    Failure to do so means you can only work with one database at a time as it replaces the database connection instead of opening a new one!

    Note that we are passing in the strings group_one and group_two these are database setting groups (in your config file you normally only have the default group).

    You can replace the group name with an array of config options, but it is better to use the groups!

    You can then run your queries as

    //query against first database
    $DB1->select(...
    
    //query against second database
    $DB2->select(...
    

    and you can close one of the connections by using $DB2->close(); or $DB1->close();

    More information can be found in the userguide

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

Sidebar

Related Questions

I had developed an application using .NET 2.0 and database as Sql Server 2005.
at work we have an application that, at first, had been developed for a
I had developed an application in visual Studio 2005. whenever i run that application
I have a developed a Restlet application. I would like to return a JSP
I had developed an application in which I have to display images from specific
I had developed an application for sending email. On click of email button it
When I developed for the iPhone I had multiple events on touch that could
Hi all i want to run a java application as backend process.that is like
I had developed a Desktop Application in .Net. I had published and deployed it
Dear All We had developed a hr application(winform) which consist of almost 98 forms

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.