Array
(
[0] => Москва
[1] => Казань
)
---------------
Москва
---------------
Казань
SELECT * FROM `main` WHERE (`city` LIKE '%Москва\r%') OR (`city` LIKE '%Казань%') LIMIT 20
public function search($params)
{
$query = Main::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'time' => $this->time,
'name' => $this->name,
]);
$string = $this->city;
$array = explode("\n", $string);
$query->andFilterWhere(['or',
['like', 'city', $array[0]],
['like', 'city', $array[1]],
])
->andFilterWhere(['and',
['>', 'price', $this->min_price],
['<', 'price', $this->max_price],
]);
return $dataProvider;
}
$query->andFilterWhere(['or',
['like', 'city', $city_str1],
['like', 'city', $city_str2],
....
['like', 'city', $city_str999],
]);
setInterval(function(){
$('.gettime').each(function(index) {
$(this).click().delay(500);
});
}, 1000);