constipation

Redd

so I took my 2 year old to the doctor because she was constipated for a week I took her to the doctor and the doctor gave her mineral oil and it didn't help at all so I took her back and the doctor said it's because of potty training because she is holding it in.is this true? have anyone else experienced this?