Multiple Databases and Multiple Domains

Comparing #1 with #5

Tags

database

Content

[...]
'username' => 'root',
'password' => 'itsasecret',
'charset' => 'utf8',
),
'db2'=>array(
'class' => 'CD
BbConnection',
'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::$
db2->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".
[...]