CI_DB_active_record::get PHP Method

get() public method

Compiles the select statement based on the other functions called and runs the query
public get ( $table = '', $limit = null, $offset = null ) : object
return object
    function get($table = '', $limit = null, $offset = null)
    {
        if ($table != '') {
            $this->_track_aliases($table);
            $this->from($table);
        }
        if (!is_null($limit)) {
            $this->limit($limit, $offset);
        }
        $sql = $this->_compile_select();
        $result = $this->query($sql);
        $this->_reset_select();
        return $result;
    }

Usage Example

Esempio n. 1
0
 /**
  * 批量读取数据
  * @param array|string $where 条件
  * @param string $order 排序字段
  * @param int $limit 查询数量
  * @param int $offset 查询起始偏移量
  * @return array
  */
 public function fetchAll($cols = '*', $where, $order, $limit = NULL, $offset = NULL)
 {
     $this->db->select($cols);
     $this->where($where);
     if (!empty($order)) {
         $this->db->order_by($order);
     }
     return $this->db->get($this->_name, $limit, $offset)->result_array();
 }
All Usage Examples Of CI_DB_active_record::get