Question:I’ve been sitting for hours trying to find how to get values from table’s
category_name. I’ve found only the way to echo all table names:
Answer:You can use query builder to do that:
select()method sets what columns should be included in result. The
from()method sets what table should be queried. And the
column()method executes the query and return first column from result set as array.
EDIT: now, I’ve realized that even though you’ve mentioned Yii 2 in title the code you’ve included in question looks more like Yii 1.x. So there is query builder version for Yii 1.x:
If you have better answer, please add a comment about this, thank you!