CodeIgniter Multiple database.
Database PostgrePemanggilan database MySQL di controller :
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "postgres";
$db['default']['password'] = "pwdx1";
$db['default']['database'] = "db_postgres";
$db['default']['dbdriver'] = "postgre";
$db['default']['dbprefix'] = "";
$db['default']['port'] = 5432;
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
//Database MySQL
$db['mysqldb']['hostname'] = "localhost";
$db['mysqldb']['username'] = "root";
$db['mysqldb']['password'] = "pwdx2";
$db['mysqldb']['database'] = "db_mysql";
$db['mysqldb']['dbdriver'] = "mysql";
$db['mysqldb']['dbprefix'] = "";
$db['mysqldb']['pconnect'] = FALSE;
$this->mysqldb = $this->load->database('mysqldb',TRUE);
$query = $this->mysqldb->query("select *from tabel");
foreach ($query->result() as $row){
}
Tidak ada komentar:
Posting Komentar