0

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'].'%')
4

2 回答 2

1

假设您有两个相似的值

将相似的词分配给一个变量,例如,keyword

并尝试:

$this->Model->find('all', array(
'conditions' => array('Model.column LIKE' => '%keyword%')
)); 
于 2012-05-16T09:00:41.987 回答
0

发现我的错误。实际上,我没有将查询的值存储到我试图在控制器中挑战的变量中。所以这就是我现在得到的:

$address = array('UserDetail.address LIKE'=>'%'.$filterparams['address'].'%');
于 2012-05-17T00:43:54.817 回答