If you have the range array_slice
is what you will need.
http://www.php.net/manual/en/function.array-slice.php
In your scenario:
$database = array("data1","data2","data3","data4");
$result = array_slice($database, 1, 2);
var_dump($result);
If you didn't know the range, you can find it using array_search
http://uk3.php.net/array_search
In your scenario:
$database = array("data1","data2","data3","data4","data5","data6","data7","data8","data9");
$startKey = "data2";
$endKey = "data6";
$startRange = array_search($startKey, $database);
$endRange = array_search($endKey, $database);
$result = array_slice($database, $startRange, $endRange - $startRange + 1);
var_dump($result);
Careful though, if you have more than one of the same value, it will use the first one it finds in the array.
W