[eluser]incog03[/eluser]
I've made a website which grabs a bunch of results and paginates them, 10 results per page. The URI ends in /10 or /20 or /30 etc. But what I also want to do is get results based on links on my front page with categories, ie basketball, netball, soccer. Clicking these links will bring up threads based on these values only.
My question is - how do I pass the value "basketball" back to the controller/model if the URI is already being used to paginate the results? Each time i do it my queries fail because the query start point is "basketball", instead of the normal 0 10 20 etc, and the result limit is unchanaged at 10.
I guess i'm looking for a way to pass 2 variables back to the controller, so that I can use 1 function to handle all the links and database queries instead of individual functions for each link on my website.
I hope i've been clear, I'm trying to make this sound as clear as possible and it's surprisingly difficult to do so!
Code:
$this->load->library('pagination');
$this->load->model('query');
$this->load->model('search');
$config['uri_segment'] = 3;
$config['base_url'] = base_url().'search/index';
$config['per_page'] = 10;
$config['total_rows'] = $this->query->countResult();
$config['num_links'] = 8;
$page = ($this->uri->segment(3))? $this->uri->segment(3) : 0;
$data['result'] = $this->query->grab_result_list($config['per_page'],$page);
$this->pagination->initialize($config);
$data['link'] = $this->pagination->create_links();
$searchdata = $this->search->searchresults();
My query would look like this;
Quote: $query = $this->db->query("SELECT * FROM game
INNER JOIN sportType st
ON st.userID = game.userID
WHERE st.classification = 'golf'
LIMIT $start, $limit");
where the sport classification may change from golf to tennis to football etc etc. How do I pass these different variables back to the same function - along with the pagination data?