Order By Persian Title In MySQL

--

1: Change Collection Field To “utf8_persian_ci

2: In Query

SELECT * FROM campaigns ORDER BY title COLLATE utf8_persian_ci

3: In Yii Framework

$academics = Academic::find()

->where([

‘organization_id’ => $_POST[‘organization’],

‘academic_year_id’ => $_POST[‘academicYear’],

‘base_id’ => $_POST[‘base’],

‘field_id’ => $_POST[‘field’]

])

->andWhere([‘IN’,’status’,$arrayStatus])

->joinWith(‘profiles p’)

  • >orderBy(new \yii\db\Expression(‘p.lname COLLATE utf8_persian_ci’));

Enjoy It.

--

--

Yadollah khaje hosseini
Yadollah khaje hosseini

No responses yet