Changes
Title
unchanged
Multiple Databases and Multiple Domains
Category
unchanged
Tutorials
Yii version
unchanged
Tags
changed
database
Content
changed
[...]
'username' => 'root',
'password' => 'itsasecret',
'charset' => 'utf8',
),
'db2'=>array(
'class' => 'CDBbConnection',
'connectionString' => 'mysql:host=localhost;dbname=database2',
'emulatePrepare' => true,[...]
{
// Create CDbConnection and set properties
self::$db
= = new CDbConnection(
Yii::app()->db2->connectionString,Yii::app()->db2->username,Yii::app()->);
foreach(Yii::app()->db2 as $key => $value)
self::$db
2->
password)$key = $value;[...]
```
###For each model using the second database,extend the above file example;
<br />
```php
/**
* This is the model class for table "pagedata".[...]