Difference between #1 and #5 of
Multiple Databases and Multiple Domains

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' => '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".
[...]
13 2
15 followers
Viewed: 55 357 times
Version: 1.1
Category: Tutorials
Tags: database
Written by: got 2 doodle
Last updated by: Maurizio Domba Cerin
Created on: Jul 30, 2010
Last updated: 13 years ago
Update Article

Revisions

View all history