The NHS website recommend that if you need to stop diarrhoea for a few hours, you can take loperamide (imodium), although this is not suitable for children under 12, or with a fever. This medicine is an anti-motility medicine and slows down food as it goes through your gut.
Most people don’t realise that loperamide is a synthetic opiate that blocks the opioid receptors in the gut. However, at very high doses, the medication can cross the blood-brain barrier and cause opioid-like effects. So, it is important to follow the instructions and not take loperamide for more than 48 hours without talking to a doctor, and only take the recommended amount. It also has many common side effects and some serious side effects, although they are rare.