Advice please

Has anyone ever had a bladder or urine infection whilst pregnant the doctor said it puts me at risk of miscarriage I’m fully freaking out