Thanks for contacting healthcare magic.
You have problem of
irritable bowel syndrome that can treated by some diet modifications.
Take high fiber food like oats ,whole grains, beans etc...
High fiber food helpful to change a consistency of stool.
Avoid stressful condition.
Avoid gaseous food like cabbage, cauliflower, carbonated drinks etc. ..
If you have
lactose intolerance than Avoid dairy products.
Gluten free diet is helpful in celiac problem.
Simethicon drugs can take for gas relief.
Avoid dairy product and fatty food.
Eat fresh fruits and green vegetables.
Consent a gastroenterologist for further treatment.
I hope my guidance is helpful to you.
Take care.
Thank you.