Diarrhea, comes at the most inconvenient times, and you always feel a bit embarrassed to say it as an excuse.
Here are some tips to prevent it
Every few hours eat blackberries in any form you like, jam, raw, or juice. This will make you feel instantly better, it is an old cure that is very effective.
If you peel an apple and let it sit until it turns brown, and then eat it. If you let the apple stand you let out the pectin of the fruit. This is the main thing in most over the counter diarrhea medicines.
If you get diarrhea after eating a dairy product you may be lactose intolerant. They have over the counter medicines that contain an enzyme to allow you to eat dairy products without getting diarrhea. So you might want to look into that if you believe yourself to be lactose intolerant.
Drink plenty of fluids when you get diarrhea. Dehydrations is what can make diarrhea very dangerous so make sure you have plenty of fluids.