You have to look into using the models attribute useDbConfig, see the
CakePHP book at:
http://book.cakephp.org/view/1058/useDbConfig

and applying it in the controllers beforeFilter method depending on
your requirement.
Enjoy,
   John

On 21 Feb., 12:19, andreguerreiro85 <andreguerreir...@gmail.com>
wrote:
> Hi there, i'm using cake 1.2.5 and i need to switch database at login on user
> choice, i have two Databases already defined :
>
>         var $default = array(
>    'driver' => 'mysql',
>         'persistent' => false,
>         'host' => 'localhost',
>         'login' => 'root',
>         'password' => '',
>         //'database' => 'test',
>         'database' => 'testesul2011',
>         );
>
>         var $comercial = array(
>   'driver' => 'mysql',
>         'persistent' => false,
>         'host' => 'localhost',
>         'login' => 'root',
>         'password' => '',
>         'database' => 'test',
>         );
>
> At Login i want to alow users to select one of them at a list and then set
> the database.
> Thanks in advance
> --
> View this message in 
> context:http://cakephp.1045679.n5.nabble.com/Change-the-Database-at-Login-by-...
> Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to