Get Method

Get method is part of database class builder for filtering result in array of array or array of object.

Parameters

Group By method has 2 parameter

$this->db->get_first([string $result_type, [bool $is_debug]]): mixed

$result_type

Result type consist of array and object, if value has "array" the result will be array of array otherwise will returned array of object.

Example usage

Here is the examples using select 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 getList($id){
    $this->db->select("id");
    $this->db->select("title");
    $this->db->select("content");
    $this->db->from($this->tbl,$this->tbl_as);
    return $this->db->get();
  }
  public function getListArray(){
    $this->db->select("id");
    $this->db->select("title");
    $this->db->select("content");
    $this->db->from($this->tbl,$this->tbl_as);
    return $this->db->get('array');
  }
  public function getListDebugQuery($id){
    $this->db->select("id");
    $this->db->select("title");
    $this->db->select("content");
    $this->db->from($this->tbl,$this->tbl_as);
    return $this->db->get('array',1);
  }
}