shop;
$collection = $db->orders;
$search = $_GET['ordersearch'];
$js = "function () { var query = '". $search . "'; return this.id == query;}";
//print $js;
print '
';
$cursor = $collection->find(array('$where' => $js));
echo $cursor->count() . ' order(s) found.
';
foreach ($cursor as $obj) {
echo 'Order ID: ' . $obj['id'] . '
';
echo 'Name: ' . $obj['name'] . '
';
echo 'Item: ' . $obj['item'] . '
';
echo 'Quantity: ' . $obj['quantity']. '
';
echo '
';
}
$conn->close();
} catch (MongoConnectionException $e) {
die('Error connecting to MongoDB server : ' . $e->getMessage());
} catch (MongoException $e) {
die('Error: ' . $e->getMessage());
}
}
?>
Use the Order ID to locate your order: