Order By Method

Order By method is part of database class builder for sorting result query.


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 can be filled by column name or function string.


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(){
  public function getLatest($di){
    return $this->db->get();