$query = Yii::$app->db->createCommand
("
SELECT
g.ID , g.UID , u.Username , u.auth_roles_id,
g.BOT_Level, g.displayName , g.Is_BOT, g.Game , g.Data , g.Amount ,
g.Type , g.Status , g.Created_At
FROM gameroom as g
LEFT JOIN user as u ON g.UID = u.ID
WHERE g.Status = 1
ORDER BY g.Created_At ASC
")->queryall();
while ($row = $query->fetch_object()) {
Since “$query” is a list of associative arrays (returned from queryAll), you need to change “while ($row = $query->fetch_object()) {” to “foreach($query as $row) {”. Each variable “$row” is an associative array.