In your controller

If (isset($this->data['User']['username']))
{
   $user = $this->User->findByUsername($this->data['User']['username']);
}

If its a search controller, rather than in the users controller you
need to make sure you delare $uses at the top of the contoller

$uses = array('User');

As long as your table fields follow cake conventions you can do any
findByField(), check out the API docs for more info on it

Tane

On 4/11/07, szeta <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am using CakePHP in a project and would like to integrate a 'search'
> function.
>
> I'm not talking about a full index for the site (like htdig), but
> mainly a search function for specific fields.
>
> e.g. search for a person by name etc..
>
> I'm not sure what's the best way to do this.
>
> 1. Create a model 'search' with no table and execute something like
> "SELECT FROM table WHERE value LIKE '%searchvalue%'" for each field
> I'd like to search.
>
> 2. integrate a 'search' function into each controller of the existing
> models.
>
> Has somebody done something like this before and would like to share
> his experience or link to some example code?
>
> In the archive and bakery I can hardly find anything about this
> topic..
>
> Best regards
> Ralph
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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