Welcome to healthcare magic.
Mushrooms may be allergenic or cause gastric troubles in some .If you develop loose motion
then it could point to infection.But since you are constipated the pain could be due to gas itself.So try to drink plenty of water and eat something less spicy fibre rich diet.For the pain you can take analgesic
anti spasmodic like cyclopam
but if pain persists it's best to visit your doctor for thorough examination, diagnosis and appropriate treatment.