this is the example code: to join the tables. And read table Joining.

http://book.cakephp.org/view/312/Models.


var $hasMany = array(
                   'Store' => array(
                              'className' => 'Store',
                              'foreignKey' => 'division_id',
                              'conditions' => '',
                              'fields' => '',
                              'order' => ''));

 var $belongsTo = array(
                     'Country' => array(
                                  'className' => 'Country',
                                  'foreignKey' => 'country_id',
                                  'conditions' => '',
                                  'fields' => '',
                                  'order' => ''));

this is very easy to implement.

all the best.






On Tue, Jul 13, 2010 at 6:26 AM, brototyp <[email protected]> wrote:

> Hi guys, I'm pretty new in Cake and I have an issue with connecting
> two tables.
>
> I have a product table (product) with:
>
> id (auto increment), zupid (a unique product id key), productname,
> product_id, product price  .........
>
> and an other table (favs) with:
>
> id (auto increment), zupid, user_id, stats.
>
>
> Now I would like to connect those tables somehow with zupid as key (it
> has to be zupid).
> The reason for connecting is, that I want to have all product data
> when accessing the fav table in the favs view.
> So far, I only get the data from the favs table.
>
> Thanks in advance!
> Best,
> b
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Master Ram.
Founder n Director of rgPlanets Pvt. Ltd.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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