I have a problem with CI. I have a model:
public function Game($id) {
$id = (int)$id;
$q = $this -> db -> get_where('games', array('id' => $id));
return $q -> row_array();
}
Controller for it:
public function index($gameID) {
$data['game'] = $this->games_model->Game($gameID);
$this -> load -> view('games/game', $data);
}
And a problem 😉 I’ve set my routing as follows:
$route['games/(:num)'] = 'games/game/$1';
$route['games'] = 'games/game/game';
But it doesn’t work at all. My controller dir is games/game.php (with function Game inside). My problem is – how can I pass $id for it? I am very new to CI, but I couldn’t find solution for this in docs.
If you want to use slug, url_title($title, ‘underscore’, TRUE) it help you