Reputation: 2610
this is the scenario:
i typed an address in a search box: "Blk 6 lot 34 brgy teniente tiago"
it must return all the "Blk 6 lot 34 brgy teniente tiago" from the column "address" of a particular table:
say for example the addresses are these:
1 = "Blk 6 lot 34 brgy teniente tiago gma cavite"
2 = "Blk 6 lot 34 brgy teniente tiago trece martirez cavite"
3 = "Blk 100 lot 34 brgy teniente tiago gma cavite"
4 = "Blk 6 lot 34 brgy teniente tiago gma cavite"
5 = "whatever address it may be"
the 1-4 records should be displayed... but the thing is if you did not type the exact address, as in the EXACT ADDRESS, it won't return anything.
i am coding in cakephp and it looks like this:
array('UserDetail.address LIKE'=>'%'.$filterparams['address'].'%')
Upvotes: 0
Views: 1339
Reputation: 9379
Lets say you have two similar values
Assign the similar word to a varaiable e.g., keyword
and try:
$this->Model->find('all', array(
'conditions' => array('Model.column LIKE' => '%keyword%')
));
Upvotes: 1
Reputation: 2610
Found my mistake. I actually did not store the value of my query into the variable i was trying to challenge in my controller. so here's what i got now:
$address = array('UserDetail.address LIKE'=>'%'.$filterparams['address'].'%');
Upvotes: 0