Can't figure out why i get the undefined index error, when using
"COUNT() AS test" in my query...

I've tried a whole range of different ways of writing the SQL (cake
format and just straight SQL)

Seems that the view just doesn't pick up the name given after AS as a
valid field... all other fields that actually occur in the table get
recognised...

--Controller
        $conditions = array('fields' => array('*','COUNT(id) as
test'), 'group' => 'id');
        $posts = ClassRegistry::init('Calendar')->find('all',
$conditions);
        $this->set( 'posts', $posts);

--View
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['Calendar']['date']; ?></td>
<td><?php echo $post['Calendar']['test']; ?></td>
</tr>
<?php endforeach; ?>

Hope someone can help...

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