Model::select
Set Select Parameter
Description
public self Model::select( string $select )
Sets the columns of the next SELECT (default *). The text is written into the SQL as it is: never put user input in it. Like every chain method, it is reset after the query.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $select | string | Columns or expressions, separated by commas |
Example
Controller
$model = new Model(false, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));
// Get the `news_id` and `title` columns
$records = $model->select('news_id, title')->find();
// Expressions work too
$records = $model->select('category, count(*) AS n')->group('category')->all();