Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Clarified error messages of $active_group value (error msgs in DB.php) #2040

wants to merge 2 commits into from

2 participants


Used the load->model wrong (had 3rd param as class alias, not second) and spent 30 minutes tracking down the "You have specified an invalid database connection" error rendered from DB.php.

I modified the code to have two different error messages, one unset $active_group, and the other to display the active_group it was looking for.

Gregory T. C... added some commits
Gregory T. Corrigan Clarified error messages of $active_group value 5dc445b
Gregory T. Corrigan Code Formatting tweak; signoff
Signed-off-by: Gregory T. Corrigan <corrigang@taggert.(none)>

Mentioning the $active_group var is a good improvement, but I don't think that printing it's value if it exists justifies adding a few more lines to the code. Actually, the check should be shortened:

if ( ! isset($active_group, $db[$active_group]))

Okay, agreed then. But you will have to update your code to meet the styleguide and please use parenthesis and not square brackets around the group name.

Also, you'll have to change your text editor/IDE settings to not insert an extra new line at the end of file.


@corrigang Any chance that you could update this PR?

@narfbg narfbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 29, 2012
  1. Clarified error messages of $active_group value

    Gregory T. Corrigan authored
  2. Code Formatting tweak; signoff

    Gregory T. Corrigan authored
    Signed-off-by: Gregory T. Corrigan <corrigang@taggert.(none)>
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 3 deletions.
  1. +6 −3 system/database/DB.php
9 system/database/DB.php
@@ -76,9 +76,12 @@ function &DB($params = '', $query_builder_override = NULL)
$active_group = $params;
- if ( ! isset($active_group) OR ! isset($db[$active_group]))
+ if ( ! isset($active_group) )
+ {
+ show_error('You have not specified a valid database connection group using the $active_group variable.');
+ } elseif ( ! isset($db[$active_group]))
- show_error('You have specified an invalid database connection group.');
+ show_error('You have specified an invalid database connection group named [' . $active_group . ']');
$params = $db[$active_group];
@@ -211,4 +214,4 @@ class CI_DB extends CI_DB_driver { }
/* End of file DB.php */
-/* Location: ./system/database/DB.php */
Something went wrong with that request. Please try again.