Reputation: 3
i want the alternative cakephp code for the above query
Select * from book where title like '%java%;
Upvotes: 0
Views: 99
Reputation: 24334
OK, assuming you are using a find() query.
You can specify the conditions array as follows:
"conditions" => array("Book.title like" => "%java%")
or
"conditions" => array("Book.title like '%java%'")
I think both will work
Upvotes: 1
Reputation: 195
$this->Post->find('first', array (
"Author.name" => "Bob",
"OR" => array (
"Post.title LIKE" => "%magic%",
"Post.created >" => date('Y-m-d', strtotime("-2 weeks"))
)
));
Upvotes: 1