What the heck

So i am usually a person who has a regular period but this month I have had my period 3 times.... This has never happened to me and I even had to go to the ER because of the pain. I was also on a medication for a UTI and we thought that was the problem so the doctors switched my meds and then i started again...