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.
Always read the label, not a substitute for medical advice, may contain nuts etc.