D
D
des1roer2015-02-25 11:52:26
Yii
des1roer, 2015-02-25 11:52:26

Yii how to organize like type search?

How to modify standard search so that it can search in string
1,2,3 for something like like 2,3 or 2 or 1,3 ? in general, it would be ideal to suggest how to make a search based on the checkboxlist. well, we select the 1.3 element and, based on it, we do a search.
---
some kind of bug
$criteria->addSearchCondition('m_complect',$this->m_complect,true, 'LIKE');
fails with value 1,3,6 search 1,6
need query like FROM
`tbl_motor`
where `m_complect` like '%1%6%';
and it does
`tbl_motor`
where `m_complect` like '%1.6%';
and if you change it like that, then it's not right at all
$criteria->addSearchCondition('m_complect',str_replace(",", "%", $this->m_complect),true, 'LIKE');

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
des1roer, 2015-02-26
@des1roer

stackoverflow.com/questions/28720512/yii-how-to-or...

E
Eugene, 2015-02-25
@Nc_Soft

www.yiiframework.com/doc/api/1.1/CDbCriteria#addSe...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question