Might be something to do with irritable bowel or gall bladder. Do you keep track of what you are eating and specific triggers any worse than others? Any other symptoms such as nausea or cramping? Before my gall bladder was removed and IBS diagnosed that was the same situation I had. Even now I find foods that don't agree with me and I know in minutes that I ate something I shouldn't have.
I'd start keeping a diary of what you eat. Fruits and veges were actually some of the worse when I had problems. Maybe start with rice, toast, oatmeal and work your way up the food pyramid.
All anecdotal advice here from my experiences. Maybe a doctor would have much better advice.

It is a tough position to be in though when there isn't a bathroom handy or avialable when the need arises!