The secret is not to dehydrate. The NIH they say:
Medicines that stop diarrhea may be helpful, but they are not recommended for people whose diarrhea is caused by a bacterial infection or parasite. If you stop the diarrhea before having purged the bacteria or parasite, you will trap the organism in the intestines and prolong the problem.
Medications to treat diarrhea in adults can be dangerous for children and should only be given with a doctor’s guidance.
http://digestive.niddk.nih.gov/ddiseases/pubs/diarrhea/
Always read the label, not a substitute for medical advice, may contain nuts etc.
To prevent diarrhoea, there are few words to always bear in mind: COOK IT, BOIL IT, PEEL IT, OR AVOID IT! Since ingestion of contaminated food is the number one cause of acquiring diarrhoea, and there are numerous ways of possibly getting them, taking precautionary measures on the food that you consume is a simple step that can take you a long way.