Hi adam,

your $question array does not contain anything called "Answer". If you
print out the array (as Anja suggested), you will see that for
yourself.

Quite possibly, if your $question array is a result of a query in
CakePHP, your results will be ordered as $question[0]['Answer'],
$question[1]['Answer'], etc.. Assuming that your array contains only
answers, you should get a proper count by calling count($question);

Hope that helps!

On Dec 4, 10:40 pm, adam <[EMAIL PROTECTED]> wrote:
> $answer_count = count($question['Answer']);
>
> I am trying to start learning cakePHP using the book CakePHP
> Application Development.  I keep getting this error though that points
> to this line:
>
> Undefined index:  Answer [APP\views\questions\home.ctp, line 10]
>
> In home.ctp, I need to display the number of "Answer" posts.  Similar
> to Comments for blog posts, but this is Answers for question posts.
> Example in the book...but anyways.  What is wrong?
--~--~---------~--~----~------------~-------~--~----~
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