addFieldToFilter() And Condition in magento2
Try with below code,
$multiselectupdate =$multiselect->getCollection()
->addFieldToFilter('customergroup', ['eq' => $categoryname])
->addFieldToFilter('customeremails',['eq' => $mail]);
Here is the solution for you to understand how Magento 2 use query operators to filter with addFieldToFilter
click
or simple in your case:
$multiselectupdate->addFieldToFilter('customergroup', ['eq' => "$categoryname"]);
Try following way:
$multiselect->getCollection() ->addFieldToFilter('customergroup', array('eq'=>$categoryname)) ->addFieldToFilter('customeremails',array('eq'=>$mail));
No need to assign new variable again.
Debug:
echo $multiselect->count();