WHAT THE FUCK

D
so about 3 weeks ago i had a very bad uti which caused me to not eat for days, had back pain, etc it was horrible i had to stay home for a week from school bc i was sooo sick. but i went to the doctor and got medicine and it was meds for 10 days, 2 pills a day.. I took them all obviously and it's about a week later after i've been done and my uti is BACK?!!!!!??! WTF IS GOING ON. I just peed and it kind of hurt and my pee smells again. I'm so mad and over it. How can i prevent these? I pee after sex, i drink water, i don't hold my pee in.. like what is going on omg