Question: I am trying to route multiple HTTP methods (GET and POST) to display the same content. For instance, I have a register page:

```
$app->map('/admin/register', function () use ($app) {
    $app->render('/admin/register.twig');
})->via('GET', 'POST');

```

This will display the register form upon GET and POST requests. I then want to specify 'extra stuff' to happen on POST.

```
$app->map('/admin/register', function () use ($app) {
    $app->render('/admin/register.twig');
})->via('GET', 'POST');

$app->post('/admin/register', function () use ($app) {
    // Validate register information
});

```

However, the second function is being ignored. I want to do this so that I can then display error messages above the register form. How would I go about achieving this?

Answer: 
Your primary problem is here:

```
    int rowId = c.getInt(0);
    while(c.getCount() > 50)
    {
        db.deleteContact(rowId);

```

I don't think the cursor gets to know that one of its rows was deleted while it was still open. So the cursor does not auto-magically remove the deleted row from its "cache", which means trouble when it comes to accessing a row via the cursor that was already deleted.

I recommend to use a single delete statement with an appropriate where clause, which will also help performance.

Maybe like this: Find the first row (minimal rowId) that you want to keep, which is the one that sits 50 rows before the last of your rows. Then you can just perform `delete from ... where _id < minimalRowId`. Have a look at [moveToPosition](http://developer.android.com/reference/android/database/Cursor.html#moveToPosition%28int%29); then you can use `cursor.moveToPosition( cursor.getCount() - 50 )` to find your row of interest.
Actually you have to pass data in a coma separated string and then write delete query using IN(]multiple id's])

eg, 

```
DELETE FROM Persons
WHERE LastName IN ('Person1','Person2',"Person3")

```