find('list', array ('fields' => array ('Course.id', 'Course.name',
'College.name'))) should provide array you need.
But you can convert your array by Set::combine($data, '{n}.Course.id',
'{n}.Course.name', '{n}.College.name')

On Aug 17, 10:02 pm, hymen breaker <lunaro...@gmail.com> wrote:
>  ok..so its my first time here..past few days ive been reading and
> coding with cakephp for my school_enrollment system project..now im
> stuck with this simple problem that i cant solve.4 hours of reading
> and rereading about some cakephp articles but still no luck.. so i
> think, you guys can be a really big help..here it goes:
> this is a result of find() method (2 joined tables):
> resulting array using (print_r):
>
> CODE
>
> Array (
> [0] => Array (
> [Course] => Array (
>  [id] => 1
>  [code] => BSCS
>  [name] => BACHELOR OF SCIENCE IN COMPUTER SCIENCE
>  [college_id] => 1
>  [years] => 4
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 1
>  [code] => CAS
>  [name] => COLLEGE OF ARTS AND SCIENCES
>  [campus_id] => 1 ) )
> [1] => Array (
> [Course] => Array (
>  [id] => 2
>  [code] => BSCOMENG
>  [name] => BACHELOR OF SCIENCE IN COMPUTER ENGINEERING
>  [college_id] => 2
>  [years] => 5
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 2
>  [code] => CEA
>  [name] => COLLEGE OF ENGINEERING AND ARCHITECHTURE
>  [campus_id] => 2 ) )
> [2] => Array (
> [Course] => Array (
>  [id] => 3
>  [code] => BSINT
>  [name] => BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
>  [college_id] => 1
>  [years] => 4
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 1
>  [code] => CAS
>  [name] => COLLEGE OF ARTS AND SCIENCES
>  [campus_id] => 1 ) )
> [3] => Array (
> [Course] => Array (
>  [id] => 4
>  [code] => BSCS
>  [name] => BACHELOR OF SCIENCE IN COMPUTER SCIENCE
>  [college_id] => 3
>  [years] => 4
>  [degree_flag] => 1
>  [major_flag] => 0 )
> [College] => Array (
>  [id] => 3
>  [code] => CAS
>  [name] => COLLEGE OF ARTS AND SCIENCES
>  [campus_id] => 3 ) ) )
>
> so my problem is how can i display it on a select tag where [College]
> [name] is my optgroup label and my [Course][id] and [Course][name] as
> my key value pair options.. what i have right now only display 1
> array:
> PHP Code
> <?php
>
> echo $form->input('course_id', array('options' => array(
>                         $courses[1]['College']['name'] =>array(
>                             $courses[1]['Course']['id']=>$courses[1]
> ['Course']['name']
>                             )
>                         )
>                     )
>                     );
>
> ?>
>
> please help..thanx
--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to