Model.php
final public function doIndex($start = 0, $len = 30, $search = null)
    {
        //SEarch
        if ($search !== null && is_array($search)) {
            $tmp = ' WHERE ';
            $and = '';
            foreach ($search as $k => $v) {
                $tmp .= $and.$k.' LIKE "%'.$v.'%" ';
                $and = ' AND ';
            }
            $search = $tmp;
        } else {
            $search = '';
        }

        //Execute
        $this->db->query('SELECT * FROM '.$this->table.$search.' LIMIT '.(0+$start).', '.(0+$len));
        return $this->db->result();
    }
final public function doIndex($start = 0, $len = 30, $search = null)
    {
        //SEarch
        if ($search !== null && is_array($search)) {
            $tmp = ' WHERE ';
            $and = '';
            foreach ($search as $k => $v) {
                $tmp .= $and.$k.' LIKE "%'.$v.'%" ';
                $and = ' AND ';
            }
            $search = $tmp;
        } else {
            $search = '';
        }

        //Execute
        $this->db->query('SELECT * FROM '.$this->table.$search.' LIMIT '.(0+$start).', '.(0+$len));
        return $this->db->result();
    }
final public function doIndex ( $ start = 0 , $ len = 30 , $ search = null ) { //SEarch if ( $ search !== null && is_array ( $ search ) ) { $ tmp = ' WHERE ' ; $ and = '' ; foreach ( $ search as $ k => $ v ) { $ tmp .= $ and . $ k . ' LIKE "%' . $ v . '%" ' ; $ and = ' AND ' ; } $ search = $ tmp ; } else { $ search = '' ; } //Execute $ this -> db -> query ( 'SELECT * FROM ' . $ this -> table . $ search . ' LIMIT ' . ( 0 + $ start ) . ', ' . ( 0 + $ len ) ) ; return $ this -> db -> result ( ) ; }
Lista todos || paginado
Lista todos || paginado