I did everything right before I went to India three weeks ago, but I still got a bad stomach after approx 30h.
Turns out it was the malaria medication my doctor prescribed me that caused it. The day after I stopped taking it, my stomach returned to normal.
So my advice, just make sure you eat stuff that is well cooked and only drink bottled water/sodas and stay away from the most spicy things and you'll be fine.