Revision #5 has been created by toph on Aug 31, 2016, 8:09:57 AM with the memo:
Code formatting
« previous (#4)
Changes
Title
unchanged
How to create a criteria condition for a multiple value text search i.e a "LIKE IN"
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
search, like, in, cdbcriteria
Content
changed
[...]
For a scenario where only the name field above is the only condition a single CDbCriteria instance will do i.e
```php
$c1= = new CDbCriteria;
foreach
($search_values as $txt)
{
$c1->compare('name',
$txt,
true,
'OR');
}
```[...]
```php
$c1= = new CDbCriteria; // original criteria
$c2
= = new CDbCriteria; // criteria for handling our search values
foreach
($search_values as $txt)
{
$c2->compare('name',
$txt,
true,
'OR');
}[...]
```php
$c1= = new CDbCriteria; // original criteria
$c2
= = new CDbCriteria; // criteria for handling our search values
foreach
($search_values as $txt)
{
$c2->compare('name',
$txt,
true,
'OR');
}
$c1->addCondition($c2->condition);
$c1->params
+=
$c2->params; // Add the params for $c2 into $c1
```