Order By Method
Order By method is part of database class builder for sorting result query.
Parameters
Insert method has 2 required parameters that is column name and sort direction.
$this->db->group_by(string $column_name, string $sort_direction): dbObject
$column_name
Column Name can be filled by column name or function string.
$sort_direction
Sort Direction value consist of asc and desc. "asc" for ascending and "desc" for descending
Example usage
Here is the examples using order_by method. See the first of this page for full example.
Basic Usage
For example we assumed want to add new data in blog table. First, in the model:
class Blog_Model extends SENE_Model{ var $tbl = 'blog'; var $tbl_as = 'b'; public function __construct(){ parent::__construct(); } public function getLatest($di){ $this->db->order_by("create_date","desc"); return $this->db->get(); } }