I’m scared

I’m 6 weeks pregnant and having sharp pain in my right side and pelvic bone with brown discharge and I’m scared I’m currently in the er because of it!! I’m scared to lose the baby I know it was unplanned but I still love him/her!