Wednesday, September 17, 2008

problem using find method in cakephp with conditions contains 'LIKE'

i am a new comer in cakephp.. i am going through some tutorials in
cakephp.. i found one problem i want to write find method for the
following query

SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name`
FROM `books` AS `Book`
WHERE `Book`.`title` LIKE 'A%'
ORDER BY `Book`.`isbn` DESC
LIMIT 2;

i wrote

find(
'all',
array(
'conditions' => array('Book.title' => 'LIKE A%'),
'fields' => array(
'Book.isbn',
'Book.title',
'Book.author_name'
),
'order' => 'Book.isbn DESC',
'limit'=>2
)
);


but it create a query like this..

SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name`
FROM `books` AS `Book`
WHERE `Book`.`title` = 'LIKE A%
ORDER BY `Book`.`isbn` DESC
LIMIT 2;


i.e, LIKE keyword is not working properly... did i do anything
wrong?...
plz help me if anybody have any idea about it...
thanks,
jittos....

--~--~---------~--~----~------------~-------~--~----~
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: