Help please

How do you know when you have a yeast/bacteria infection? What can I do to prevent one?