Sex hurting stomach

Whenever I have sex I have bad stomach pains and diarrhea afterwards. What do I do?