Hello and Welcome to ‘Ask A Doctor’ service.
I have reviewed your query and here are my thoughts.
Bloating with pain in abdomen is suggestive of
intestinal obstruction and loose motions can be due to the medications or irritation to the bowel. Intestinal infection can give similar picture.
Hence you need the following although you already have visited ER.
X-ray of abdomen in standing position will tell about intestinal obstruction, fecoliths or so.
Ultrasonography and CT scan help to find out any inflammatory problems like
diverticulitis,
appendicitis.
Tests of stool, blood and urine.
Clinical evaluation by a Doctor, preferably a
General surgeon.
All these help to know the exact cause of your symptoms so that an appropriate management can be done.
I hope this answer helps you.
Let me know if I can assist you further.