array(
'Inmsg.user_id' => $this->Session->read('Auth.User.id'),
"or" => array (
"Inmsg.text LIKE" => "%".$search_term."%",
"Contact.number LIKE" => "%".$search_term."%"
)
)
views:
76answers:
2
A:
Short of removing some of the criteria, this is the already the simplest notation for what you are trying to achieve.
neilcrookes
2009-09-29 21:00:54
+1
A:
Nitpicking:
array(
'Inmsg.user_id' => $this->Auth->user('id'),
"or" => array (
"Inmsg.text LIKE" => "%$search_term%",
"Contact.number LIKE" => "%$search_term%"
)
)
If what you want to search for is "text or number by logged in user contains $search_term
", this is about as simple as you can get. You'll have to provide more context for possible further refinement.
deceze
2009-09-30 03:58:37
yes thats what i want to do... what i didnt like about the query is that i repeat %search_term% twice and that i basically repeat the same thing twice on two different tables.
ondrobaco
2009-09-30 12:08:41