How I will access a table from another Databse in cakephp -
My project has two databases. I have declared two connection variables in database.php I like the following:
var $ development = array ('driver' = & gt; mysql ',' persistent '= & gt; wrong,' host '=> gtxxx', 'login' = & Gt; 'xxxx', 'password' = & gt; 'xxxx', 'database' = & gt; 'yyyy', 'prefix' =>;); Var $ production = array ('driver' = & gt; 'mysql', 'persistent' = & gt; wrong, 'host' = & gt; 'xxxxxx', 'login' => 'xx', 'password '= & Gt;' xx ',' database '=> gt;' xxx ',' prefix '=> gt; Now I am using development as the default connection.
In a controller function, I need to get some value from some DAB. How do I get other DB data out there? If any body can help in this, I will make it very strange. Thank you in advance.
You can define which database to use by using $ useDbConfig in your model class For data source
class example AppModel extended {var $ useDbConfig = 'development'; } Class example AppModel extended {var $ useDbConfig = 'production'; } and you can check the usage of extensions in the KPP document
Comments
Post a Comment