On Nov 15, 12:00 pm, phpMagpie <[email protected]> wrote:
> try echo debug($comments); in your view to see if the array does contain
> any data.
>
> HTH, Paul.

I found the problem, an if statement in the view was stopping the code
for the table from executing:
<?php if (!empty($post['Comment'])):?>
I changed it to:
<?php if (!empty($comments)):?>

Now I have a new error related to the index in $comments:
Undefined index: Comment

...here is the line in question:
foreach ($comments['Comment'] as $comment):

Here is a dump of the array $comments:

Array
(
    [0] => Array
        (
            [Comment] => Array
                (
                    [id] => 7
                    [post_id] => 27
                    [name] => some comment
                    [content] => hello
                    [created] => 2011-11-14 18:58:52
                    [modified] => 2011-11-14 18:58:52
                )

        )

)

What am I doing wrong?

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