Question: i just wanted to insert data into database from a form, with php. i ran the code below in my Localhost using XAMPP and everything was fine but where i upload it to my host it didn't work.

Question is *What shold i put for $servername and when should i look for it ?*

There is my codes:

Register.php (in localhost)

```
<?php

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";

$Name = $_POST['Name'];
$Username = $_POST['Username'];
$Password = $_POST['Password'];
$Email = $_POST['Email'];

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    header("Location:#");
}

//Inserting Data
 try{
$sql = "INSERT INTO User (uName , uUsername , uPassword , uEmail) VALUES ('$Name' , '$Username' , '$Password' , '$Email')";
mysqli_query($conn, $sql);
 }catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
 }
$conn->close();
header("Location:#");
}
?>

```

Answer: 
It sounds like you just want a mix of [`Skip`](https://msdn.microsoft.com/en-us/library/bb358985(v=vs.110).aspx) and [`Take`](https://msdn.microsoft.com/en-us/library/bb503062(v=vs.110).aspx), filtering with [`Where`](https://msdn.microsoft.com/en-us/library/system.linq.enumerable.where(v=vs.110).aspx):

```
var query = list.Skip(index - 3)    // Start at appropriate index
                .Take(3)            // Only consider the next three values
                .Where(x => x > 5); // Filter appropriately

```

Personally it seems a little odd to me that the index would be the *end* point rather than the *start* point, mind you. You might want to see if other pieces of code would benefit from changing that.
An alternative to `Skip` and `Take` would be to include the item index in the `Where` clause

```
list.Where((x, i) => // x is the list item, i is its index
    i > (index - 3) && i <= index && // index bounds
    x > 5 // item condition
)

```

For you specific requirement with a single sub-range of items, I'd go with the `Skip` and `Take`, but if you ever need a more complex condition on the item index, you can utilize this `Where` overload.