Hi! I've been having some problems querying two data models that are related by a HABTM association.
Basically I have two models User and Feed linked by a HABTM association which use the following database tables. users feeds feeds_users (join table) The association seems to be working as when I issue a this->set('data', $this->User->findAll()); I get an array containing all the data defined by the HABTM association as expected. However, when I try to return only the Feed urls for a specific user I get this error. "SQL Error in model User: 1109: Unknown table 'Feed' in field list" even though I have defined Feed in the uses array for the Users model. Is it possible to request a 'foreign table' field in the $field list in findAll or can this only be used for local model fields? The controller code that causes the error is here? Class UsersController extends AppController { var $name = 'Users'; var $uses= Array('User', 'Feed'); function viewbyuser($id) { $data= $this->User->findAll("User.id ='$id'", 'Feed.url'); // Fails //$data= $this->User->findAll("User.id ='$id'", 'User.passwd'); // Is OK! $this->set('data', $data); } } I'm new to this so hopefully its something I've overlooked? Any help appreciated. Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---