Thursday, August 4, 2011

Formatting arrays returned using Find('all')

Perhaps using Set::Format or another method. Can anyone describe an
efficient way of converting the following array. In reality the array
is much longer and I was a foreach loop to re-create the array but
this was very time consuming - maybe there is a way to get it
formatted when querying the database:

Array
(
[0] => Array
(
[Industry] => Array
(
[id] => 1
[industry] => Basic Materials
[ShowInLists] => 1
)

)

[1] => Array
(
[Industry] => Array
(
[id] => 2
[industry] => Consumer Goods & Services
[ShowInLists] => 1
)

)....

to this:

Array
(
[0] => Array
(
[id] => 1
[industry] => Basic Materials
[ShowInLists] => 1
)

[1] => Array
(
[id] => 2
[industry] => Consumer Goods & Services
[ShowInLists] => 1
)...

Thanks.

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate