I need a dynamic db config. I have to pick the name of the database i
want to connect from my session data. In The irc channel someone told
my that i have to put this in an before filter method:

var $beforeFilter = array ('_selectDatabase');

and in my method:

function _selectDatabase ()
        {
                if (APP_TYPE == 'online')
                {
                        $db =& ConnectionManager::getDataSource('default');
                        $db->disconnect();
                        $db->config['database'] = $_SESSION['datenbank'];
                        //print_r($db->config);
                        $db->connect();
                }
        }

but it did not work. it semms that i cannot connect to my db!
The print_r($db->config); prints the correct credentials out. What i am
doing wrong?

greets and many thanks
alex


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to