period while pregnant

I had to go to the ER last night because I was in a lot of pain. They took blood from me before they ranned any tests and I then learned I was pregnant. I suspected I was pregnant almost 2 months ago but all the tests were negative so I thought my symptoms were menstrual related. When it was time for my period, my period came. I gained weight prior to me even thinking that I was pregnant. my periods are very irregular so my dates were wrong I guess. anyone experienced this? my periods go from starting on the 30th of one month and the 3rd of the next month. It flops back and forth. I'm just confused