Difference between #12 and #13 of
Common Yii questions

Revision #13 has been created by GoofyX on Oct 18, 2011, 8:47:26 AM with the memo:

Typo fixed.
« previous (#12) next (#18) »

Changes

Title unchanged

Common Yii questions

Category unchanged

FAQs

Yii version unchanged

Tags unchanged

yii, common, questions, beginners

Content changed

[...]
<hr/>

### How to connect to database in controller?

#### Answer:
The best approach is to set db con
enection in your main.php config.

The second one would be just using the CDbConnection::__construct

Examples for both aproaches can be found here
[Guide::Establishing Database Connection](http://www.yiiframework.com/doc/guide/1.1/en/database.dao#establishing-database-connection "http://www.yiiframework.com/doc/guide/1.1/en/database.dao#establishing-database-connection")
[...]
14 0
23 followers
Viewed: 44 768 times
Version: 1.1
Category: FAQs
Written by: dckurushin
Last updated by: migajek
Created on: Oct 17, 2011
Last updated: 6 years ago
Update Article

Revisions

View all history