Answer the question
In order to leave comments, you need to log in
Yii2 compose query via LIKE?
Hello.
You need to make a query like this:
SELECT * FROM news WHERE date_news LIKE '____-$var-__';
$events = News::find()
->where(['LIKE', 'date_news', '____-' . $incident . '-__'])
->all();
SELECT * FROM `news` WHERE `date_news` LIKE '%\\_\\_\\_\\_-12-\\_\\_%'
$events = News::find()
->where("date_news LIKE '____-$incident-__' ")
->all();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question