1
1
123 1232016-12-23 06:40:28
Yii
123 123, 2016-12-23 06:40:28

How to choose a database connection?

There are two connections to the database, the first one is default. I need to switch to the second database during this request.

$cities = City::model()->findAll("name LIKE :name", array(':name'=>"%$query%"));

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Wolf, 2016-12-23
@Wolfnsex

Here they write how to change the connection to the database in Yii-1. And also here ...

D
Dmitry Bay, 2016-12-23
@kawabanga

В настройках модели можно указать соединение. yii1 уже года 2 не видел, но изменить можно вот в этой функции -
public function getDbConnection() {}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question