I am glad to receive your question because the sooner you treat an infection, the easier it is to get rid of it. If you notice some yellowing and lifting with debris under the nail - you may have a fungal infection. Trim any loose nail. Apply a topical antifungal cream to the exposed skin. You can find a non-prescription antifungal cream in the foot health section of your pharmacy or supermarket.
If the infection is more severe and the nail is thick, I am afraid that the chance of the cream providing a cure is quite low. If you have a thick nail (or you did not notice improvement with your home treatment), you will need to schedule a visit to your podiatrist for care of the thick nail and a discussion of effective treatment options. We will often take a clipping of the nail to confirm that you do indeed have a fungal nail infection.
Remember the best protection is prevention so avoid situations that expose the foot to fungus. Good luck!