i need to connect for many databases the primary connection in the database.php and there is no problem with that
but the another connections must be in Model
i use this class
<?php
class user_model extends CI_Model {
public function test()
{
$specific['hostname'] = "localhost";
$specific['username'] = "root";
$specific['password'] = "";
$specific['database'] = "ci_forsyria";
$specific['dbdriver'] = "mysql";
$specific['dbprefix'] = "";
$specific['pconnect'] = FALSE;
$specific['db_debug'] = TRUE;
$specific['cache_on'] = FALSE;
$specific['cachedir'] = "";
$specific['char_set'] = "utf8";
$specific['dbcollat'] = "utf8_general_ci";
$this->load->database($specific);
//get data using datamapper
$o = new db_user();
$array = array();
$o->where($array)->get();
echo $num_rows = $o->result_count();
}
}
?>
but the connection is not work it's still connect with the primary database
Error Number: 1146 Table 'countries.ci_users' doesn't exist
Note: i don't wont to but the another connections in the database.php file because i have more than 100 connections