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'));
source
share