Dave,
'conditions' => array('Profile.company LIKE' => $i . '%'),
http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html
Andras Kende
http://www.kende.com/
On Sep 3, 2010, at 5:49 PM, Dave Maharaj 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
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