Hi,

> As of right now, I do it in a really bad way.. I have a loop that goes
> from A->Z which SELECT COUNTS each letter and throws everything in one
> array.
>
> What's a better way to do that? Instead of have 26 queries?

You search for "LIKE {letter}%", eg:

public function search($letter='a')
{
        $conditions = array('Page.name LIKE'=>$letter.'%');
        $this->data = $this->Page->find('all', array(
                'conditions'=>$conditions
        ));
        $this->autoRender = 0;
}

hth

Jon



-- 
jon bennett - www.jben.net - blog.jben.net

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