This example shows how to use a query to get a page of
search results from the database.
<?php
$searchterm = "pandas";
$pagenum = 2;
$resultsPerPage = 10;
$conn = mongo_connect("localhost", true);
if (!$conn) {
die("Could not connect.");
}
$cursor = mongo_query($conn, "zoo.animals", array("name" => $searchterm), ($pagenum-1)*$resultsPerPage, $resultsPerPage, null, null, null);
?>
This returns results 11-20 of objects in the zoo.animals collection with the name field "panda".