• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Yii2 How to get all values from column (DB)

Resolved: Yii2 How to get all values from column (DB)

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I’ve been sitting for hours trying to find how to get values from table’s iab_categories column category_name. I’ve found only the way to echo all table names:
Can anyone help me?

Answer:

You can use query builder to do that:
The 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!

database php yii yii2
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How can I write CSS selector(s) that apply to table rows for all td elements on that row after a td with a certain class?

01/04/2023

Resolved: How do I use SetWindowText with Unicode in Win32 using PowerShell?

01/04/2023

Resolved: Shopware 400 Status Error “This value is too long. It should have 255 character or less.” When I Try Updating Database Table

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.