Yeast infection?!

I went to the doctor today and my doctor told me I have a small vaginal yeast infection, but she did not tell me how I got it or what to do to heal it. I’m sexually active and I’m not sure what to do? Am I not supposed to have sex now? Or what do I do? How does one get a yeast infection?