Where in Method

The where_in method is part of database class builder for filtering data compatible with WHERE IN Clause on SQL. This method support chained as well.

Basic Usage

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

$this->db->where_in(string $column_name, array $array_selector[, int $is_not=0]): $this->db;

Parameters

This method has 2 required parameters.

$column_name

The $column_name value can be column name of table or full qualitfied name.

$array_selector

The $array_selector value can be an array contains the value for filtering data.

$is_not

The $is_not for where not in operation if value is equal 1.

Example

Here is the examples using where_in method in a model class.

class Blog_Model extends SENE_Model{
  var $tbl = 'd_order';
  var $tbl_as = 'dor';
  var $tbl2 = 'b_user';
  var $tbl2_as = 'bu';
  public function __construct(){
    parent::__construct();
    $this->db->from($this->tbl,$this->tbl_as);
  }
  public function Ids($ids){
    $this->db->select("$this->tbl_as.*, $this-tbl_as.status_text",'status_text',0);
    $this->db->select("$this->tbl2_as.fname",'fname',0);
    $this->db->select("$this->tbl2_as.email",'email',0);
    $this->db->where_in("$this->tbl_as.id", $ids);
    return $this->db->get();
  }
}