• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search With Pagination ?

#1
I am having an issue with search with pagination .. 
My Controller Code is 

Code:
public function search($keyword= null){
        $keyword = $this->request->getVar('search');
        if ($keyword==null) {
            return redirect('admin/media');
        }else{
            $data['medias'] = $MediaModel->search($keyword);
            $data = [
                'medias' => $MediaModel->paginate(3),
                'pager' => $MediaModel->pager
            ];
            // Page Heading
            $data['page_heading'] = 'Manage Media';
            $data['content_view'] = 'Demo\Media\Views\Manage';
            echo view('Demo\Themes\Views\Base', $data);
        }
        
    }

My Model Code is 
Code:
public function search($keyword){
        $builder = $this->db->table($this->table);
        $builder->like('media_name', $keyword);
        $query = $builder->get();
        return $query->getResultArray();
    }

Help Please Search is Not working,showing all data
Reply

#2
PHP Code:
$data['medias'] = $MediaModel->search($keyword); 

the result is overwritten by


PHP Code:
$data = [
                'medias' => $MediaModel->paginate(3),
                'pager' => $MediaModel->pager
            
]; 
Test your translation files with Translation Tester
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.