if you have relations in models created, than this should be automatically

so, probably
User BelongsTo City
Secretquestion belongsTo City

City hasMany User
City hasMany Secretquestion

http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html

read here how to read data :)

--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/20 Blues Clues <[email protected]>

> Hi
> I want to use cakephp model behaviour to do this. Can you help?
>
> I have a user table which stores id(s) for city, secretquestion etc.,
> so my 'user' table has city_id and secretquestion_id and the actual
> names/texts for these are stored in City & Secretquestion tables
> respectively.
>
> Now, I am coding UsersController. When I read my User table, I get
> these IDs obviously. But I need to retrieve these names (City Name,
> Secretquestion Text) for subsequent use.
>
> How can I do that? Can someone shed light on the steps involved?
>
> I can simply write a SQL and do that but I want to utilize CakePHP
> Model functionality and handle this the CakePHP way.
>
> Thanks
> -BC
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to