Taebu / prq

prq.co.kr
MIT License
1 stars 0 forks source link

블로그 관련 다중 디비 설정 #61

Closed Taebu closed 7 years ago

Taebu commented 7 years ago

[예제] 다중디비 사용하기 http://codeigniter-kr.org/bbs/view/source?idx=7481 글쓴이 ci세상 작성시각 2009/11/07 01:17:12

/application/config/database.php

$active_group = "";
$active_record = TRUE;

$db['cidb1']['hostname'] = "localhost";
$db['cidb1']['username'] = "root";
$db['cidb1']['password'] = "apmsetup";
$db['cidb1']['database'] = "cidb1";
$db['cidb1']['dbdriver'] = "mysql";
$db['cidb1']['dbprefix'] = "";
$db['cidb1']['pconnect'] = FALSE;
$db['cidb1']['db_debug'] = TRUE;
$db['cidb1']['cache_on'] = FALSE;
$db['cidb1']['cachedir'] = "";
$db['cidb1']['char_set'] = "utf8";
$db['cidb1']['dbcollat'] = "utf8_general_ci";

$db['cidb2']['hostname'] = "localhost";
$db['cidb2']['username'] = "root";
$db['cidb2']['password'] = "apmsetup";
$db['cidb2']['database'] = "cidb2";
$db['cidb2']['dbdriver'] = "mysql";
$db['cidb2']['dbprefix'] = "";
$db['cidb2']['pconnect'] = FALSE;
$db['cidb2']['db_debug'] = TRUE;
$db['cidb2']['cache_on'] = FALSE;
$db['cidb2']['cachedir'] = "";
$db['cidb2']['char_set'] = "utf8";
$db['cidb2']['dbcollat'] = "utf8_general_ci";

/application/models/blog_m.php

class Blog_m extends CI_Model
{
    function __construct()
    {
        parent::__construct();
        $this->prq = $this->load->database('default', TRUE);
        $this->cashq = $this->load->database('cashq', TRUE);
    }
Taebu commented 7 years ago

블로그 타 디비 쓰기 마무리