Answer the question
In order to leave comments, you need to log in
How to select only some columns in yii2 and not the whole row from the database?
This is how all the data is taken and everything works:
$db = new database();
$rows = $db->find()->All();
$db = new database();
$rows = $db->find()->select('id','name')->All();
$db = new database();
$rows = $db->find('id','name')->All();
Answer the question
In order to leave comments, you need to log in
Take 'id','name' in brackets []
$db = new database();
$rows = $db->find()->select(['id','name'])->All();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question