Thanks for query.
It seems that you might have acute bacillary dysentery
causing pain and frequency of passing stool.
As you get this problem often,go for stool test
to find out the cause,wheather it is amebic or bacillary dysentery.
After report go for treatment accordingly.
Take light diet like curd,buttermilk,rice.
Take plenty of water.
Avoid fried and junk food.
Ok and bye.