City belongsTo State

Assuming Cake 1.2:
$cities = $this->City->find('list', array('fields'=>array('City.id',
City.name', 'State.name'), 'recursive'=>1) );

Then you can have a form select with cities as the data source, you
should get exactly what you want.


On May 12, 9:00 am, Kyle Decot <[EMAIL PROTECTED]> wrote:
> I want to make a side nave bar with states and cities of that state as
> sub items. How would I write a query to do this? I want something
> like:
>
> Florida
> _Orlando
> _Daytona
> Ohio
> _Columbus
> _New Albany
>
> etc...
>
> Thanks as always for the help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to