I have a mongoDB collection named order. I am trying to get all order details for the customer currently logged in. I am using the customers email as reference to the logged in user. This line, echo "email is ".$email; displays the email correctly. However I am unable to display other data. Can you help me please?
<?php
$mongoClient = new MongoClient("mongodb://localhost:27017");
$db = $mongoClient->commerce;
$email = filter_input(INPUT_POST, "email", FILTER_SANITIZE_STRING);
echo "email is ".$email;
$findCriteria = [
["customer_email" => $email]
];
$cursor = $db->order->find($findCriteria);
echo "<h1>Order History</h1>";
foreach ($cursor as $ord) {
$email = $ord['customer_email'];
/* $price = $cust['cost'];
$products = $cust['products'];*/
echo "test";
echo "email is ".$email;
/*echo "<br>";
echo "email is ".$price;
echo "<br>";
echo "email is ".$products;
echo "<br>"; */
}