Thanks for your query.
is usually related to dietary intake,but certain conditions like hypothyroidism
.fissures,hircshprung's disease needs to be ruled out.
Since your child is not having this problem frequently so there is nothing to worry.
Increase intake of water and fiber ,give salads,green leafy vegetables.fruits.honey.
Avoid juices.Do not give any fried or junk food.
Whenever she has problem give her sitz bath(make her sit in tub of lukewarm water for 10 to 15 minutes 2 to 3 times a day.
In case problem persist get her evaluated by pediatrician
Wishing your child good health.