Hello,
This is my code
$query = "SELECT * FROM users WHERE id IN (:id_array)";
return Yii::$app->db->createCommand($query)->bindValues([
':id_array' => [6]
])->queryAll();
This code above not working, this error appears “Undefined array key 1”, when the array length is one.
While the following code works fine :
$query = "SELECT * FROM users WHERE id IN (:id_array)";
return Yii::$app->db->createCommand($query)->bindValues([
':id_array' => [6,5]
])->queryAll();
The difference between the 2 codes is the array length.
And for another reasons I have to use ActiveQuery not ActiveRecord