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
No comments:
Post a Comment