kingsol
(Yii)
1
Hello, noob to the framework. I am having trouble getting the tablePrefix setting to work.
I add this to the db array in config/main.php
‘tablePrefix’ => ‘bl_’,
The way I am testing if it works (which may be where I have my problem)… is this:
[list=1]
[*]I have the user module loaded
[*]I go to user/install
[*]click install
[*]run show tables;
[*]and none of the tables created by user module have the prefix
[/list]
Am I doing something wrong? Thanks for your help
falcon
(Faelconn1ck)
2
I also facing table prefix problem.
I had configure config/main.php ‘tablePrefix’=>‘pre_’, and then use the query like this :
$sql=‘SELECT * FROM {{user}}’; (http://www.yiiframework.com/doc/guide/1.1/en/database.dao#using-table-prefix)
But I fail to do it.
The i print the connection resource and i notice that table prefix param is null.
$connection = new CDbConnection($connStr, $user, $pass);
print_r($connection);
[tablePrefix] => //no value
Anyone know how to solve it?
Each
(Rikius)
3
check how it works in yii blog demo.
falcon
(Faelconn1ck)
4
For those who still encounter this problem, can refer below:
$tablePrefix = Yii::app()->db->tablePrefix;
$conn = new CDbConnection($connStr, $user, $pass);
$conn->tablePrefix = $tablePrefix;