I have been extremely gassy lately now I'm experiencing bloating & what seems to be bladder pain what could be wrong?

This has been happening for 2 weeks now but I'm just now experiencing pain & when I do poop it's not often & it will be diarrhea is it just constipation? How do I go back to normal? & what causes constipation?