CodeIgniter Forums
PROBLEM - nvalid database connection group - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: PROBLEM - nvalid database connection group (/showthread.php?tid=65142)



PROBLEM - nvalid database connection group - jushto - 05-05-2016

Hi,

First of all, sorry for my poor english, ill try to do my best to explain my problems with ci 3.0.6.

I have done a fresh install on debian and im trying to use mysqli driver to do my db connections.

In config/database i have this parameters.

PHP Code:
$active_group 'default';
$query_builder TRUE;

$db['default'] = array(
    
'dsn'    => '',
    
'hostname' => '10.229.0.112',
    
'username' => 'XXXX',
    
'password' => 'XXXX',
    
'database' => 'Informes',
    
'dbdriver' => 'mysqli',
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => (ENVIRONMENT !== 'production'),
    
'cache_on' => FALSE,
    
'cachedir' => '',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 


In the model.

PHP Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class 
Question_model extends CI_Model
{
 
   public function __construct()
 
   {
 
       parent::__construct();
 
       $this->load->database('default');
 
   }

 
   // Metodo que devuelve todas las filas de la tabla Pregunta en questionWeb
 
  public function setResponse($pregunta,$usuario,$respuesta)
 
  {
 
     
      
      if 
($respuesta=="zero")
 
     {
 
       $respuesta="0";
 
     }
 
     $consulta=$this->db->query("INSERT INTO RespuestasFIN values(".$pregunta.",'".$respuesta."','".$usuario."')");

 
     if ($this->db->affected_rows() == 1)
 
       {
 
         return true;
 
       }
 
  }

}

?>

And when i try to execute my controller, it shows me this error:

Quote:You have specified an invalid database connection group (questionWeb) in your config/database.php file.

I dont understand why it talks about "questionWeb" when my group connection is "default" :S.

Can anyone help me?

Sorry for my english!


RE: PROBLEM - nvalid database connection group - InsiteFX - 05-05-2016

If your running this on your own system and not the web then hostname should be localhost.

Most database servers use localhost as the name try that.


RE: PROBLEM - nvalid database connection group - jushto - 05-05-2016

i know this but im running the codeigniter in another serv thats not my machine.

Thanks anyway.


RE: PROBLEM - nvalid database connection group - andersonunsonst - 05-05-2016

show your controller where load this model


RE: PROBLEM - nvalid database connection group - Narf - 05-09-2016

What you've shown is not your full config/database.php file ... somewhere in it you have $active_group = 'questionWeb' and that's what causing the error.


RE: PROBLEM - nvalid database connection group - cnngraphics - 09-29-2018

this is just enough:
  $this->load->database();


no need to say 
  $this->load->database('default');

default is already default in this case