CI_DB_query_builder::get_where PHP Method

get_where() public method

Allows the where clause, limit and offset to be added directly
public get_where ( string $table = '', string $where = NULL, integer $limit = NULL, integer $offset = NULL ) : CI_DB_result
$table string
$where string
$limit integer
$offset integer
return CI_DB_result
    public function get_where($table = '', $where = NULL, $limit = NULL, $offset = NULL)
    {
        if ($table !== '') {
            $this->from($table);
        }
        if ($where !== NULL) {
            $this->where($where);
        }
        if (!empty($limit)) {
            $this->limit($limit, $offset);
        }
        $result = $this->query($this->_compile_select());
        $this->_reset_select();
        return $result;
    }

Usage Example

Exemplo n.º 1
0
 protected function is_unique($field, $value, $id)
 {
     $where = [$field => $value];
     if ($id) {
         $where[] = "id != {$id}";
     }
     return !$this->db->get_where($this->table, $where)->row_array();
 }
All Usage Examples Of CI_DB_query_builder::get_where