If the pill was prescribed by the doctor that suggested the rash was from a fungus, or other bacteria, then he was probably on the right track. It is quite possible that either you didn’t have enough medication to completely kill of the virus, or perhaps when you noticed the symptoms were gone you choose to stop taking the medication. You should always take your prescribed medication till they are gone, unless your doctor tells you otherwise.
The fungus suggestion does seem likely. The sweat on your skin is a perfect environment for bacteria and fungus to thrive. And we all know that sweat is caused by the sun, or exertion, or a combination of them both. It could however be a misdiagnosis of the symptoms; perhaps you don’t have any fungus or bacteria on you. If you suspect that is the case you should visit another doctor and get a second opinion.
Good luck.