macha
macha

Reputation: 7487

Query by field name in cakephp

Hello I have a very simple question, how do we query by field name?? I am using the regular query method, but I want to learn how it is done by one of the cakePHP methods, which would look like $this->Model->find('/*something like a query*/').

I am presently using the query method like $this->Model->query('select field_name from table_name');

Upvotes: 0

Views: 175

Answers (1)

pawelmysior
pawelmysior

Reputation: 3250

$this->Model->find('all', array('fields' => array('field_name')));

You can find more on retrieving your data in the Cookbook.

Upvotes: 1

Related Questions