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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:04:47+00:00 2026-06-15T01:04:47+00:00

Pardon for my beginner in object oriented PHP Codeigniter. I am confused about using

  • 0

Pardon for my beginner in object oriented PHP Codeigniter. I am confused about using $this->subquery->defaultDB() in https://github.com/NTICompass/CodeIgniter-Subqueries?

$db2 = $this->load->database('db2', TRUE);

$this->load->library('Subquery');
$this->subquery->defaultDB($db2)
$sub = $this->subquery->start_subquery('select');
$sub->select('number')->from('numbers')->where('numberID', 2);
$this->subquery->end_subquery('number');

$query = $db2->get('mytable');

but the subquery still use the default database not db2. Am I doing something wrong? Thank you.

  • 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-15T01:04:48+00:00Added an answer on June 15, 2026 at 1:04 am

    I have created issue to its repository and the author said he will fix it on a few days.

    If you are in a rush using this code, I have an alternative. I add forth param defaultDB to be used in subquery. Hope it helps. Cheers!

    function start_subquery($statement, $join_type='', $join_on=1, $defaultDB=''){
        $db = $this->CI->load->database($defaultDB, true);
        $this->dbStack[] = $db;
        $this->statement[] = $statement;
        if(strtolower($statement) == 'join'){
            $this->join_type[] = $join_type;
            $this->join_on[] = $join_on;
        }
        return $db;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pardon me if this has already been asked (I know very little about Data
Pardon me for giving you a confusing title on this problem. I'm really confused
I am an iOS newbie, so please pardon me if this is a beginner
Please pardon the beginner question.I met this code fragment on the internet: public class
I'm a beginner using webservices with jquery, so pardon for asking dumm questions. so
Please pardon this Spring beginner question. I am reading chapter 4 of first edition
Pardon me if this question has already been asked. HttpContext.Current.Session["key"] returns an object and
Pardon if this is a n00b question, I'm a n00b to grails... I have
Perhaps this is a very basic question, please pardon me if it is ---
Pardon for this, i just get this error in console but i can't see

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.