-1

what's so? I have a question, I am beginning to learn yii 1.1. For work reasons I started with this version. My problem is this and I want to know if it is possible to do so. I have two different databases on the same server (localhost).

What I need to do is show in a view a grid with some data from one of the databases and another grid (in the same View) with other data from the other database. I have models and the method getConnection () in active record to select the two bases but I do not know how to add the data of that second grid that contains information from the other database. I hope you can guide me I am very lost and frustrated of many failed attempts.

Thank you so much!

niac
  • 33
  • 2
  • 17
Gabo MDA
  • 13
  • 4

1 Answers1

0

you have to configure your database connection as an array type.

'db1'=>array(...),
'db2'=>array(...),

and from your controller you can now call what database you should use.

$query1=Yii::app()->db1->createCommand(...)->queryAll();
...
$query2=Yii::app()-db2->createCommand(...)->queryAll();

hope it will help.

max mac
  • 1
  • 3