Cramps at school

When I'm at school, I get bad cramps. It always happens in class and I usually go to the bathroom at hunch over my tummy. What can I do so if the teachers say I can't go to the bathroom? And also what can I do in class to make the cramps calm down? Please, I need help!