Re: Use Multiple Two Database's Tables In Single Controller...

2007-11-01 Thread Gk

Hi,

http://groups.google.com/group/cake-php/browse_thread/thread/eacfade1d52c9071/f5e3c395037043b3

read above URL.

Thanks.

On Oct 31, 3:35 pm, Daivat [EMAIL PROTECTED] wrote:
 Hi,

 I have one major problem for that i am not getting the proper
 solution.

 I need to use two different tables in a single controller, but both
 tables are from two different databases.

 my database.php is as below:

 class DATABASE_CONFIG
 {
 var $default = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 '**',
 'database' = 
 'database1',
 'prefix' = 
 '');

 var $test = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 '**',
 'database' = 
 'database2',
 'prefix' = 
 '');}

 ?

 my model class contains code like below:

 ?php
 class ModelName2 extends AppModel {
 var $name = 'ModelName2';
 var $useDbConfig = 'test';
 //var $useTable = 'model_names';}

 ?

 controller contains:

 class MyController extends AppController {
   var $name = 'My';
   var $uses = array('ModelName1','ModelName2');
...
...
...
...

 }

 But such code give me error like below:
 Fatal error: Cannot redeclare class dbosource in /www/
 */cake/libs/model/datasources/dbo_source.php on line
 1716

 Please help me to fix this problem


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



Use Multiple Two Database's Tables In Single Controller...

2007-10-31 Thread Daivat

Hi,

I have one major problem for that i am not getting the proper
solution.

I need to use two different tables in a single controller, but both
tables are from two different databases.

my database.php is as below:

class DATABASE_CONFIG
{
var $default = array('driver' = 'mysql',
'connect' = 
'mysql_connect',
'host' = 
'localhost',
'login' = 
'root',
'password' = 
'**',
'database' = 
'database1',
'prefix' = '');

var $test = array('driver' = 'mysql',
'connect' = 
'mysql_connect',
'host' = 
'localhost',
'login' = 
'root',
'password' = 
'**',
'database' = 
'database2',
'prefix' = '');
}
?

my model class contains code like below:

?php
class ModelName2 extends AppModel {
var $name = 'ModelName2';
var $useDbConfig = 'test';
//var $useTable = 'model_names';
}
?

controller contains:

class MyController extends AppController {
  var $name = 'My';
  var $uses = array('ModelName1','ModelName2');
   ...
   ...
   ...
   ...
}

But such code give me error like below:
Fatal error: Cannot redeclare class dbosource in /www/
*/cake/libs/model/datasources/dbo_source.php on line
1716

Please help me to fix this problem


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



Re: Use Multiple Two Database's Tables In Single Controller...

2007-10-31 Thread Claudia

Maybe this helps?
http://groups.google.com/group/cake-php/browse_thread/thread/eacfade1d52c9071/f5e3c395037043b3

Good luck

Claudia

On Oct 31, 11:35 am, Daivat [EMAIL PROTECTED] wrote:
 Hi,

 I have one major problem for that i am not getting the proper
 solution.

 I need to use two different tables in a single controller, but both
 tables are from two different databases.

 my database.php is as below:

 class DATABASE_CONFIG
 {
 var $default = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 '**',
 'database' = 
 'database1',
 'prefix' = 
 '');

 var $test = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 '**',
 'database' = 
 'database2',
 'prefix' = 
 '');}

 ?

 my model class contains code like below:

 ?php
 class ModelName2 extends AppModel {
 var $name = 'ModelName2';
 var $useDbConfig = 'test';
 //var $useTable = 'model_names';}

 ?

 controller contains:

 class MyController extends AppController {
   var $name = 'My';
   var $uses = array('ModelName1','ModelName2');
...
...
...
...

 }

 But such code give me error like below:
 Fatal error: Cannot redeclare class dbosource in /www/
 */cake/libs/model/datasources/dbo_source.php on line
 1716

 Please help me to fix this problem


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



Re: Use Multiple Two Database's Tables In Single Controller...

2007-10-31 Thread Grant Cox

Are you sure you haven't made any other changes to your cake install?
I've used multiple databases before with no problem - just define the
two connections in your /app/config/database.php , then set the
appropriate $useDbConfig in the models.  The only issue is that with
MySQL the two connections need to have different usernames/passwords,
as otherwise it can attempt to query on the wrong one occasionally.
But I've still never seen the error you posted above.


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