From Method

From method is part of Query Builder for selecting table with its alias. This method support chaining method.

Basic Usage

Here is the basic usage from method from $db property on SENE_Model class.

$this->db->from(string $table_name[, string $table_alias=""]): $this->db

Parameters

This method has 1 required parameter and 1 optional parameter.

$table_name

The $table_name value can contain string that refer to table name.

$alias

The $alias value can contain about string that aliased the value of $table_name. This value are required if using the Join Method .

Example

Here is the example for from in a model class.

class Blog_Model extends SENE_Model{
  var $tbl = 'blog';
  var $tbl_as = 'b';
  public function __construct(){
    parent::__construct();
  }
  public function countList(){
    $this->db->from($this->tbl,$this->tbl_as);
    return $this->db->get();
  }
}