Thursday, July 30, 2009

Re: HABTM search custom query

you need to set the conditions for your query in the $paginate
variable.

$this->paginate = array('whatever models and conditions array')

http://book.cakephp.org/view/249/Custom-Query-Pagination


On Jul 30, 4:48 pm, cookiebaker <rsujee...@gmail.com> wrote:
> Hi,
>  This is my first post and please forgive me if this question is
> already answered. I building a business directory and I encounter a
> problem when searching using paginate.
> This is my simplified database design
> sections ( id, name)
> categories_sections(category_id, section_id)
> categories (id, name, keywords)
> businesses_categories (business_id, category_id);
> businesses (id, name, phone, ..., keywords)
> I want to do a keyword search, it should search the following fields
> businesses.name, businesses.keywords, categories.name and
> categories.keywords for match
> e.g: Business.name LIKE '%$searchTerm%' OR Business.keywords LIKE '%
> $searchTerm%' OR Category.name LIKE '%$searchTerm%' Category.keywords
> LIKE '%$searchTerm%'
--~--~---------~--~----~------------~-------~--~----~
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: