This basically says that your array $question doesn't contain any 'Answer'.
Oh my that is nearly philosophical.... Let's look for the answers :c)
In your case start with
pr($question);
and see what you have in your array. If there is no ['Answer'] you have at least the answer to your question :-)
Anja
-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von adam
Gesendet: Donnerstag, 4. Dezember 2008 22:41
An: CakePHP
Betreff: What is wrong with this line of code?
$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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment