Pay careful attention to the order of the parameters in the `$query_params` array. `id` comes last because it was assigned to `$3` in the SQL statement
### Hook the controller up with the model
Again, the route in `.htaccess` should be pretty similar to the `POST` route:
The first difference you'll see is `([0-9]+)`. This is just more regex work. It basically means any integer. If you're interested in learning more about how this works, check out [these tutorials on regex](https://www.regular-expressions.info/tutorial.html). What it allows us to do is have a route for urls like `people/123`, `people/5`, or `people/2347346`, etc.
One that same line second line of the route, you'll notice `&id=$1` at the end of the rule. This adds a second query parameter to `controllers/people.php` called `id` and sets it to whatever is inside the `()` of `^people/([0-9]+)$`. In other words, if the URL is `people/2347346`. The id query param will be 2347346.
Now let's update `controllers/people.php` to handle these requests. Add the following:
```php
} else if ($_REQUEST['action'] === 'update'){
$request_body = file_get_contents('php://input');
$body_object = json_decode($request_body);
$updatedPerson = new Person($_REQUEST['id'], $body_object->name, $body_object->age);
$allPeople = People::update($updatedPerson);
echo json_encode($allPeople);
}
```
This is very similar to the create action. The only real difference is that we use `$_REQUEST['id']` to fetch the id of the person to be updated from the URL of the route. Everything else for the new `Person` object comes from the request body as normal.