3

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 Answers 2

2

You may check these link1, link2

and also this SO post

Sign up to request clarification or add additional context in comments.

1 Comment

First link appears to be dead.. fyi
0

Use this code within model class.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.