Avoid buffets unless you can be sure the food has not been sitting out for a long time. Avoid roadside stands and street vendors. There is a notoriously high risk of TD associated with food from these sources. Fortunately, if you do suffer, it is possible to treat yourself. The key is to keep hydrated.
Dehydration can be serious, especially for infants, children, and the elderly.
Eat what you can, but avoid dairy products. Many people try to stop diarrhea as soon as it develops. Diarrhea is the body's way of getting rid of whatever food, virus, or bug that is causing it. If you are staying in one place for a few days, it's best to let nature take its course. However, that's not always possible, especially if you are touring.