Dear all,

I just started using CakePHP for developing my company website.
Have searched the forum, but couldn't find any info.

Need to acces 2 tables which located in 2 different database from a
controller.
But, I can't get it to work.
I read the manual on accessing more than one model from a controller
(http://manual.cakephp.org/chapter/controllers).
It seems that it only works if the tables are in one same database.

Here is an example :
This is  the content of language.php :
class Language extends AppModel
{
  var $name = 'Language';
  var $useDbConfig = 'global';
  var $useTable = 'languages;
}


This is  the content of site.php:
class Site extends AppModel
{
  var $name = 'Site';
  var $useDbConfig = 'en';
  var $useTable = 'sites';
}

Then in sites_Controlller.php I tried to access both of the table.
class SitesController extends AppController {
        var $name = 'Sites';
        var $uses = array('Site' , 'Language');

        function index()
        {
          set('test_site',  $this->Site->findByContent('desciption);
          set('test_language',  $this->Language->findByLanguage('en');
        }
}

It works for $test_language, it displays the value.
But it display nothing for $test_site. It's empty.
When I set the DEBUG to 2, I see that it run the query on
global.sites, instead of en.sites table.
Did I forget anything here ?
Or maybe it doesn't allow a control accessing tables in different
database?

Any help will be very appreciated.
TIA

?>


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to