@scotty_walker
In Yii2, the select() query in ActiveRecord returns an array of rows from the database table. To access the values from select(), you can use the following steps:
1
|
$data = YourModel::find()->select('column1, column2')->all(); |
1 2 3 4 5 6 |
foreach ($data as $row) { $value1 = $row['column1']; $value2 = $row['column2']; // Access more columns if needed // ... } |
Note that in the select() method, you need to pass the names of the columns separated by commas. In the foreach loop, you can access the values using the array index with the column name.