mi file config.php is:
$active_group = \'default\';
$active_record = TRUE;
db master is unique DB
$db[\'master\'][\'hostname\']
Thanks, thiagobraga. But...
public function m_cargar_tareas_activas($group_name)
{
...
its parameter $group_name, would have to go for all my methods My solution is:
database.php
$active_group = 'master';
$active_record = TRUE;
$db['master']['hostname'] = "localhost";
$db['master']['username'] = "root";
$db['master']['password'] = "";
$db['master']['database'] = "admin_nb";
$db['master']['dbdriver'] = "mysqli";
$db['master']['dbprefix'] = '';
$db['master']['pconnect'] = FALSE;
$db['master']['db_debug'] = TRUE;
$db['master']['cache_on'] = FALSE;
$db['master']['cachedir'] = "";
$db['master']['char_set'] = "utf8";
$db['master']['dbcollat'] = "utf8_general_ci";
My new file helper:
db_dinamic_helper
trabajador.php
load->driver('cache');
$this->load->helper(array('form', 'url','otros_helper','fechas_helper','imagen_helper','config_helper','permisos_helper'));
$this->abbost_hotel = @$this->session->userdata('sess_abbost_hotel_'.substr(base_url(),-8,7));
if(!@$this->abbost_hotel->usuario_id) redirect ('acceso');
$nombre_bd = $this->abbost_hotel->nombre_bd;
$config_app = switch_db_dinamico($nombre_bd);
$this->load->model(array('model_producto','model_trabajadores','model_habitacion','model_tareas','model_notif'));
$this->model_trabajadores->app_db = $this->load->database($config_app,TRUE);
$this->model_habitacion->app_db = $this->load->database($config_app,TRUE);
$this->model_producto->app_db = $this->load->database($config_app,TRUE);
$this->model_tareas->app_db = $this->load->database($config_app,TRUE);
$this->model_notif->app_db = $this->load->database($config_app,TRUE);
date_default_timezone_set("America/Lima");
//if(!@$this->user) redirect ('inicio/login');
//$permisos = cargar_permisos_del_usuario($this->user->idusuario);
}
public function index()
{
//...
}
...And my model:
model_tareas.php
app_db->select("tarea_id, prioridad");
$this->app_db->from('tarea');
$query = $this->app_db->get();
return $query->result_array();
}
IMPORTANT¡ The file db_dinamic_helper.php initialize in file autoload.php Thanks..¡¡ :)