I am trying to display the count of items based on a category for a specific user email. This is my PHP code for the following
$email = $_SESSION['loggedInUserEmail'];
//Connect to MongoDB
$mongoClient = new MongoClient();
//Select a database
$db = $mongoClient->finchest;
$CheckEmail = [
"CustEmail" => $email,
];
$collection = $db->History;
$Criteria = array("Category" => "Fish Skins");
$returnVal = $collection->find($CheckEmail)->count($Criteria);
echo $returnVal;
This code gives me the following error
Warning: MongoCursor::count() expects parameter 1 to be boolean, array given in C:\www\FinChest\PHPecommend.php on line 89
Please help me solve it, THANKS A TON.