You should use % instead of *

On Sep 3, 4:49 pm, "Dave Maharaj" <[email protected]> wrote:
> I have this query in the model
>
> $params = array(
>
> 'conditions' => array(
>
> 'Profile.company LIKE' => $i.'*'),
>
> 'fields' => array(
>
> 'Profile.company',
>
> 'Profile.id'),
>
> 'contain' => false);
>
> $this->find('first', $params);
>
> Where $i is a single letter so I am trying to get the first record starting
> with A for example produces this SQL query
>
> SELECT `Profile`.`company`, `Profile`.`id` FROM `profiles` AS `Profile`
> WHERE `Profile`.`company` LIKE 'A*' LIMIT 1
>
> And even though I have a Profile.company record in the database starting
> with 'A' nothing is found. Where am I going wrong? I simply want to find 1
> record where the Profile.company starts with $i.
>
> Thanks,
>
> Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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