How to select only one specific field from a model in zend framework

How to select only one field from the table inside the model. For example: table1(field1, field2 , ..)andselect only field 1

+3
source share
1 answer

Do you need only one value or a rowset with one column?

In the first case, you can use fetchOne ():

$ result = $ db-> fetchOne ('SELECT bug_status FROM bugs WHERE bug_id = 2');

Or you can make a choice only with the fields you want to receive:

$ select = $ db-> select () -> from (array ('t' => 'table1'), Array ('field1'));

+9
source

Source: https://habr.com/ru/post/1780615/


All Articles