How did I get an UTI

Meghan • Live well, laugh often, love much
I peed after I had sex the other day and I now have what I think is an UTI. Is there any other way you can get one? Or can UTI happen even if you pee after sex?