-
-
Save og-shawn-crigger/2702049 to your computer and use it in GitHub Desktop.
search method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function search() | |
{ | |
Console::log($this->input->get_post('search_feeds')); | |
$data = array( | |
'search_feeds' => $this->input->get_post('search_feeds') | |
); | |
Console::log($data); | |
$this->form_validation->set_data($data); | |
$this->form_validation->set_rules('search_feeds', 'Search', 'required'); | |
$results = NULL; | |
if ($this->form_validation->run($this) !== FALSE) | |
{ | |
$this->suppliers_model->set_table(FALSE); | |
// Pagination | |
$offset = $this->input->get('per_page'); | |
$this->pager['base_url'] = current_url().'?search_feeds='. $this->input->get_post('search_feeds') .'&'; | |
$this->pager['total_rows'] = $this->suppliers_model->count_all(); | |
$this->pager['per_page'] = 1; | |
$this->pager['page_query_string'] = true; | |
$this->load->library('pagination', $this->pager); | |
$results = $this->suppliers_model | |
->limit($this->pager['per_page'], $offset) | |
->find_all_by(array ('supplier_code LIKE ' => '%'.$this->input->get_post('search_feeds').'%')); | |
// Check your last query in phpmyadmin or whatever you use | |
Console::log($this->db->last_query() ); | |
$this->suppliers_model->set_table(); | |
} | |
Template::set('results', $results); | |
Template::set('search_string', $this->input->get_post('search_feeds')); | |
Template::set('toolbar_title', 'Search Feeds'); | |
Template::set_view('/content/search'); | |
Template::render(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added some logging