Welcome Guest, Not a member yet? Register   Sign In
Passing parameter to the model..?

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:
$route['countries/:num'] = "countries/display/$id";
Because I remember from my RoR days that it's more "RESTful" to have routes display like this for a display command: /controller/: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:
function display($id)
    $data['id'] = $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:
  echo $id;

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?

Sorry, I fixed it... Changed the route to:

$route['countries/(:num)'] = "countries/display/$1";

Theme © iAndrew 2016 - Forum software by © MyBB