i'm still learning the inner workings of cakephp and have been
confused for a while now.

heres a simple view:

<?php foreach($books as $book): ?>
    <?php echo $book['Book']['isbn']; ?>
    <?php echo $book['Book']['title']; ?>
<?php endforeach; ?>

when i call:

$books = $this->Book->find('all', array(
                                                    'fields' => array
('isbn', 'title'),
                                                    'order' =>
'Book.id DESC'
                                                ));

all is well everything works perfectly with the array structure of:
Array
(
    [0] => Array
        (
            [Book] => Array
                (
                    [isbn] => 8475836578
                    [title] => PHP & MySQL Development
                )

        )

    [1] => Array
        (
            [Book] => Array
                (
                    [isbn] => 2222222229
                    [title] => Devil Wears Prada
                )

        )
)

when i call:find('first, ...) the array structure changes to:

Array
(
    [Book] => Array
        (
            [isbn] => 8475836578
            [title] => PHP & MySQL Development
        )

)

the view breaks after this, now i know its simply fixed my question is
is it normal that the array structure changes when calling find('all)
vs. find('first')?

--~--~---------~--~----~------------~-------~--~----~
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