Don't count on tourist areas on the coast to fully protect you from infections. Yes, the risk is lower in Bangkok and at popular resorts, but mosquitoes and contaminated water are everywhere. The main thing is not to panic and take prevention seriously, not treat it like a formality.
Besides what was mentioned in the previous answer, remember about typhoid and hepatitis A - they're transmitted through dirty water and food. Symptoms can be confused with regular food poisoning, but they last longer and are more severe. There's also leptospirosis (enters the body through small cuts when exposed to water during the rainy season), tuberculosis (rare, but tourists sometimes catch it in overcrowded buses), and street intestinal infections. There are vaccines for typhoid and hepatitis A - it makes sense to get them before the trip, it's more reliable than counting on luck.
Practically speaking: wash your hands before eating, drink only bottled or boiled water (even for brushing your teeth), don't eat street food from sketchy vendors, after sunset wear pants and long-sleeved shirts, use repellent on your skin. And yeah, pack a good anti-diarrheal medication - not a cure-all, but it saves you on the road.