Passing parameter to the model..? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Passing parameter to the model..? (/showthread.php?tid=31377) |
Passing parameter to the model..? - El Forum - 06-16-2010 [eluser]ChaosKnight[/eluser] So I solved my previous newbie post for returning results from the database.. Now I have to pass a parameter id. In my routes I configured this route: Code: $route['countries/:num'] = "countries/display/$id"; So I figured that the function display() will be called and the $id variable in the route will be passed as one of its parameters, so I tried this: Code: function display($id) And when I tried to check that the value passed is correct before I attempt to mess around in the model, I echoed the variable $id in the view: Code: <?php But then I found that nothing is echoed even though the parameter was supposed to carry the value of "1". Where did I go wrong? Thanks! Passing parameter to the model..? - El Forum - 06-16-2010 [eluser]ChaosKnight[/eluser] Sorry, I fixed it... Changed the route to: $route['countries/(:num)'] = "countries/display/$1"; |