3
votes

I am new to Zend Framework. I have declared database name and user name/password in application.ini like this:

resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "root"
resources.db.params.dbname = "abc"

Now when I make a model class ,then I have to just declare table name like

protected $_name = "table1"

then it just to connect to "table1" in db "abc". Now I want to change dbname to "xyz" and connect to table "table2". Can I do it without changing the default database in application.ini somewhere in model class.

Thanks in advance.

2

2 Answers

2
votes

You may check these link1, link2

and also this SO post

0
votes

Use this code within model class.

public function __construct($config = array()) {
    $config['schema'] = "db_name";
    parent::__construct($config);
}