Answer the question
In order to leave comments, you need to log in
How to make data selection by first letter yii2?
Hello, help me, I can’t get into my head anymore (and I don’t know).
You need to select values that start with a letter.
$q = LETTER;
$query = Model::find()->where(['like','name', $q])->orderBy('name ASC')->all();
So he naturally gives me all the meanings where the letter is present. not the first.
Tell me how to do it better?
Answer the question
In order to leave comments, you need to log in
$query = Model::find()->where('name LIKE :q')->addParams(['q'=>$q . '%'])->orderBy('name ASC')->all();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question